diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-04-16 15:07:42 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-04-17 18:51:28 +0300 |
commit | 159806140fd33e6ddab951c0f6f180cfbf927d38 (patch) | |
tree | da076be3baa4d987fb5935e220a3d901c926e0e7 /source/blender | |
parent | 28b996a9d2090efdd74115a653629ef9d7d871f7 (diff) |
Removing Blender Game Engine from Blender 2.8
Folders removed entirely:
* //extern/recastnavigation
* //intern/decklink
* //intern/moto
* //source/blender/editors/space_logic
* //source/blenderplayer
* //source/gameengine
This includes DNA data and any reference to the BGE code in Blender itself.
We are bumping the subversion.
Pending tasks:
* Tile/clamp code in image editor draw code.
* Viewport drawing code (so much of this will go away because of BI removal
that we can wait until then to remove this.
Diffstat (limited to 'source/blender')
139 files changed, 119 insertions, 18860 deletions
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt index 316ab531a05..5709ac723f4 100644 --- a/source/blender/CMakeLists.txt +++ b/source/blender/CMakeLists.txt @@ -26,7 +26,6 @@ set(SRC_DNA_INC ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_ID.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_action_types.h - ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_actuator_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_anim_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_armature_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_boid_types.h @@ -36,7 +35,6 @@ set(SRC_DNA_INC ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_cloth_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_color_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_constraint_types.h - ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_controller_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_curve_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_customdata_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_defs.h @@ -72,12 +70,10 @@ set(SRC_DNA_INC ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_outliner_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_packedFile_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_particle_types.h - ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_property_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_rigidbody_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_scene_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_screen_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_sdna_types.h - ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_sensor_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_sequence_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_smoke_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_sound_types.h diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index d269a2fb63b..b038559e717 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -695,13 +695,6 @@ DerivedMesh *mesh_create_derived_no_deform_render( struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); -/* for gameengine */ -DerivedMesh *mesh_create_derived_no_virtual( - struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, - float (*vertCos)[3], CustomDataMask dataMask); -DerivedMesh *mesh_create_derived_physics( - struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, - float (*vertCos)[3], CustomDataMask dataMask); DerivedMesh *editbmesh_get_derived_base( struct Object *ob, struct BMEditMesh *em, CustomDataMask data_mask); diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index f7ebe85bcef..a203b76ea26 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -163,9 +163,6 @@ struct bPoseChannel *BKE_pose_channel_get_mirrored(const struct bPose *pose, con bool BKE_pose_channels_is_valid(const struct bPose *pose); #endif -/* Copy the data from the action-pose (src) into the pose */ -void extract_pose_from_pose(struct bPose *pose, const struct bPose *src); - /* sets constraint flags */ void BKE_pose_update_constraint_flags(struct bPose *pose); diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 901f9e6d3ac..1e970291c01 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -28,7 +28,7 @@ * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 280 -#define BLENDER_SUBVERSION 5 +#define BLENDER_SUBVERSION 6 /* Several breakages with 270, e.g. constraint deg vs rad */ #define BLENDER_MINVERSION 270 #define BLENDER_MINSUBVERSION 6 diff --git a/source/blender/blenkernel/BKE_bullet.h b/source/blender/blenkernel/BKE_bullet.h deleted file mode 100644 index dc522d1b22c..00000000000 --- a/source/blender/blenkernel/BKE_bullet.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) Blender Foundation. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __BKE_BULLET_H__ -#define __BKE_BULLET_H__ - -/** \file BKE_bullet.h - * \ingroup bke - */ - -struct BulletSoftBody; - - -/* allocates and initializes general main data */ -extern struct BulletSoftBody *bsbNew(void); - -/* frees internal data and softbody itself */ -extern void bsbFree(struct BulletSoftBody *sb); - -#endif - diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 5057168b9f6..3d722f5324e 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -173,7 +173,6 @@ struct SpaceOops *CTX_wm_space_outliner(const bContext *C); struct SpaceNla *CTX_wm_space_nla(const bContext *C); struct SpaceTime *CTX_wm_space_time(const bContext *C); struct SpaceNode *CTX_wm_space_node(const bContext *C); -struct SpaceLogic *CTX_wm_space_logic(const bContext *C); struct SpaceIpo *CTX_wm_space_graph(const bContext *C); struct SpaceAction *CTX_wm_space_action(const bContext *C); struct SpaceInfo *CTX_wm_space_info(const bContext *C); diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index c1b437661c5..e184fd3796b 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -102,7 +102,6 @@ typedef struct Global { /* G.f */ #define G_RENDER_OGL (1 << 0) #define G_SWAP_EXCHANGE (1 << 1) -/* also uses G_FILE_AUTOPLAY */ /* #define G_RENDER_SHADOW (1 << 3) */ /* temp flag, removed */ #define G_BACKBUFSEL (1 << 4) #define G_PICKSEL (1 << 5) @@ -154,16 +153,6 @@ enum { #define G_AUTOPACK (1 << 0) #define G_FILE_COMPRESS (1 << 1) -#define G_FILE_AUTOPLAY (1 << 2) - -#ifdef DNA_DEPRECATED_ALLOW -#define G_FILE_ENABLE_ALL_FRAMES (1 << 3) /* deprecated */ -#define G_FILE_SHOW_DEBUG_PROPS (1 << 4) /* deprecated */ -#define G_FILE_SHOW_FRAMERATE (1 << 5) /* deprecated */ -/* #define G_FILE_SHOW_PROFILE (1 << 6) */ /* deprecated */ -/* #define G_FILE_LOCK (1 << 7) */ /* deprecated */ -/* #define G_FILE_SIGN (1 << 8) */ /* deprecated */ -#endif /* DNA_DEPRECATED_ALLOW */ #define G_FILE_USERPREFS (1 << 9) #define G_FILE_NO_UI (1 << 10) diff --git a/source/blender/blenkernel/BKE_navmesh_conversion.h b/source/blender/blenkernel/BKE_navmesh_conversion.h deleted file mode 100644 index 3be363f4d7b..00000000000 --- a/source/blender/blenkernel/BKE_navmesh_conversion.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __BKE_NAVMESH_CONVERSION_H__ -#define __BKE_NAVMESH_CONVERSION_H__ - -/** \file BKE_navmesh_conversion.h - * \ingroup bke - */ - -struct DerivedMesh; - -/* navmesh_conversion.c */ -int buildNavMeshDataByDerivedMesh(struct DerivedMesh *dm, int *vertsPerPoly, - int *nverts, float **verts, - int *ndtris, unsigned short **dtris, - int *npolys, unsigned short **dmeshes, - unsigned short **polys, int **dtrisToPolysMap, - int **dtrisToTrisMap, int **trisToFacesMap); - -int buildRawVertIndicesData(struct DerivedMesh *dm, int *nverts, float **verts, - int *ntris, unsigned short **tris, int **trisToFacesMap, - int **recastData); - -int buildNavMeshData(const int nverts, const float *verts, - const int ntris, const unsigned short *tris, - const int *recastData, const int *trisToFacesMap, - int *ndtris, unsigned short **dtris, - int *npolys, unsigned short **dmeshes, unsigned short **polys, - int *vertsPerPoly, int **dtrisToPolysMap, int **dtrisToTrisMap); - -int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys, - unsigned short *polys, const unsigned short *dmeshes, - const float *verts, const unsigned short *dtris, - const int *dtrisToPolysMap); - -int polyNumVerts(const unsigned short *p, const int vertsPerPoly); -int polyIsConvex(const unsigned short *p, const int vertsPerPoly, const float *verts); -int polyFindVertex(const unsigned short *p, const int vertsPerPoly, unsigned short vertexIdx); -float distPointToSegmentSq(const float *point, const float *a, const float *b); - - -#endif /* NAVMESH_CONVERSION_H */ diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index b51c4e17394..ce918826938 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -43,7 +43,6 @@ struct Object; struct BoundBox; struct View3D; struct SoftBody; -struct BulletSoftBody; struct MovieClip; struct Main; struct RigidBodyWorld; @@ -57,13 +56,11 @@ void BKE_object_workob_calc_parent(struct Depsgraph *depsgraph, struct Scene *sc void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src); struct SoftBody *copy_softbody(const struct SoftBody *sb, const int flag); -struct BulletSoftBody *copy_bulletsoftbody(const struct BulletSoftBody *sb, const int flag); struct ParticleSystem *BKE_object_copy_particlesystem(struct ParticleSystem *psys, const int flag); void BKE_object_copy_particlesystems(struct Object *ob_dst, const struct Object *ob_src, const int flag); void BKE_object_copy_softbody(struct Object *ob_dst, const struct Object *ob_src); void BKE_object_free_particlesystems(struct Object *ob); void BKE_object_free_softbody(struct Object *ob); -void BKE_object_free_bulletsoftbody(struct Object *ob); void BKE_object_free_curve_cache(struct Object *ob); void BKE_object_free(struct Object *ob); @@ -113,14 +110,6 @@ void *BKE_object_obdata_add_from_type( int type, const char *name) ATTR_NONNULL(1); -void BKE_object_lod_add(struct Object *ob); -void BKE_object_lod_sort(struct Object *ob); -bool BKE_object_lod_remove(struct Object *ob, int level); -void BKE_object_lod_update(struct Object *ob, const float camera_position[3]); -bool BKE_object_lod_is_usable(struct Object *ob, struct ViewLayer *view_layer); -struct Object *BKE_object_lod_meshob_get(struct Object *ob, struct ViewLayer *view_layer); -struct Object *BKE_object_lod_matob_get(struct Object *ob, struct ViewLayer *view_layer); - void BKE_object_copy_data(struct Main *bmain, struct Object *ob_dst, const struct Object *ob_src, const int flag); struct Object *BKE_object_copy(struct Main *bmain, const struct Object *ob); void BKE_object_make_local(struct Main *bmain, struct Object *ob, const bool lib_local); diff --git a/source/blender/blenkernel/BKE_property.h b/source/blender/blenkernel/BKE_property.h deleted file mode 100644 index c787e8e8ed1..00000000000 --- a/source/blender/blenkernel/BKE_property.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __BKE_PROPERTY_H__ -#define __BKE_PROPERTY_H__ - -/** \file BKE_property.h - * \ingroup bke - */ - -struct bProperty; -struct ListBase; -struct Object; - -void BKE_bproperty_free(struct bProperty *prop); -void BKE_bproperty_free_list(struct ListBase *lb); -struct bProperty *BKE_bproperty_copy(const struct bProperty *prop); -void BKE_bproperty_copy_list(struct ListBase *lbn, const struct ListBase *lbo); -void BKE_bproperty_init(struct bProperty *prop); -struct bProperty *BKE_bproperty_new(int type); -void BKE_bproperty_unique(struct bProperty *first, struct bProperty *prop, int force); -struct bProperty *BKE_bproperty_object_get(struct Object *ob, const char *name); -void BKE_bproperty_object_set(struct Object *ob, struct bProperty *propc); -// int BKE_bproperty_cmp(struct bProperty *prop, const char *str); -void BKE_bproperty_set(struct bProperty *prop, const char *str); -void BKE_bproperty_add(struct bProperty *prop, const char *str); -/* should really be called '_get_valstr()' or '_as_string()' */ -void BKE_bproperty_set_valstr(struct bProperty *prop, char str[MAX_PROPSTRING]); - -#endif diff --git a/source/blender/blenkernel/BKE_sca.h b/source/blender/blenkernel/BKE_sca.h deleted file mode 100644 index 35bcd91a9b1..00000000000 --- a/source/blender/blenkernel/BKE_sca.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __BKE_SCA_H__ -#define __BKE_SCA_H__ - -/** \file BKE_sca.h - * \ingroup bke - */ - -struct Main; -struct Object; -struct bSensor; -struct bController; -struct bActuator; - -void link_logicbricks(void **poin, void ***ppoin, short *tot, short size); -void unlink_logicbricks(void **poin, void ***ppoin, short *tot); - -void unlink_controller(struct bController *cont); -void unlink_controllers(struct ListBase *lb); -void free_controller(struct bController *cont); -void free_controllers(struct ListBase *lb); - -void unlink_actuator(struct bActuator *act); -void unlink_actuators(struct ListBase *lb); -void free_actuator(struct bActuator *act); -void free_actuators(struct ListBase *lb); - -void free_sensor(struct bSensor *sens); -void free_sensors(struct ListBase *lb); -struct bSensor *copy_sensor(struct bSensor *sens, const int flag); -void copy_sensors(struct ListBase *lbn, const struct ListBase *lbo, const int flag); -void init_sensor(struct bSensor *sens); -struct bSensor *new_sensor(int type); -struct bController *copy_controller(struct bController *cont, const int flag); -void copy_controllers(struct ListBase *lbn, const struct ListBase *lbo, const int flag); -void init_controller(struct bController *cont); -struct bController *new_controller(int type); -struct bActuator *copy_actuator(struct bActuator *act, const int flag); -void copy_actuators(struct ListBase *lbn, const struct ListBase *lbo, const int flag); -void init_actuator(struct bActuator *act); -struct bActuator *new_actuator(int type); -void clear_sca_new_poins_ob(struct Object *ob); -void clear_sca_new_poins(void); -void set_sca_new_poins_ob(struct Object *ob); -void set_sca_new_poins(void); - -void BKE_sca_logic_links_remap(struct Main *bmain, struct Object *ob_old, struct Object *ob_new); -void BKE_sca_logic_copy(struct Object *ob_new, const struct Object *ob, const int flag); - -void sca_move_sensor(struct bSensor *sens_to_move, struct Object *ob, int move_up); -void sca_move_controller(struct bController *cont_to_move, struct Object *ob, int move_up); -void sca_move_actuator(struct bActuator *act_to_move, struct Object *ob, int move_up); - -/* Callback format for performing operations on ID-pointers for sensors/controllers/actuators. */ -typedef void (*SCASensorIDFunc)(struct bSensor *sensor, struct ID **idpoin, void *userdata, int cb_flag); -typedef void (*SCAControllerIDFunc)(struct bController *controller, struct ID **idpoin, void *userdata, int cb_flag); -typedef void (*SCAActuatorIDFunc)(struct bActuator *actuator, struct ID **idpoin, void *userdata, int cb_flag); - -void BKE_sca_sensors_id_loop(struct ListBase *senslist, SCASensorIDFunc func, void *userdata); -void BKE_sca_controllers_id_loop(struct ListBase *contlist, SCAControllerIDFunc func, void *userdata); -void BKE_sca_actuators_id_loop(struct ListBase *atclist, SCAActuatorIDFunc func, void *userdata); - - -const char *sca_state_name_get(Object *ob, short bit); - -#endif - diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 8c7c3fb15de..afb77bb5206 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -159,7 +159,6 @@ bool BKE_scene_use_world_space_shading(struct Scene *scene); bool BKE_scene_use_spherical_stereo(struct Scene *scene); bool BKE_scene_uses_blender_internal(const struct Scene *scene); -bool BKE_scene_uses_blender_game(const struct Scene *scene); bool BKE_scene_uses_blender_eevee(const struct Scene *scene); void BKE_scene_disable_color_management(struct Scene *scene); @@ -182,7 +181,6 @@ bool BKE_viewrender_use_shading_nodes_custom(const struct ViewRender *view_rende bool BKE_viewrender_use_world_space_shading(const struct ViewRender *view_render); bool BKE_viewrender_use_spherical_stereo(const struct ViewRender *view_render); bool BKE_viewrender_uses_blender_internal(const struct ViewRender *view_render); -bool BKE_viewrender_uses_blender_game(const struct ViewRender *view_render); bool BKE_viewrender_uses_blender_eevee(const struct ViewRender *view_render); /**********************************/ diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 27c1eeb3d77..6d8419208e8 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -83,7 +83,6 @@ set(SRC intern/boids.c intern/bpath.c intern/brush.c - intern/bullet.c intern/bvhutils.c intern/cachefile.c intern/camera.c @@ -166,13 +165,11 @@ set(SRC intern/pbvh.c intern/pbvh_bmesh.c intern/pointcache.c - intern/property.c intern/layer.c intern/layer_utils.c intern/lightprobe.c intern/report.c intern/rigidbody.c - intern/sca.c intern/scene.c intern/screen.c intern/seqcache.c @@ -222,7 +219,6 @@ set(SRC BKE_boids.h BKE_bpath.h BKE_brush.h - BKE_bullet.h BKE_bvhutils.h BKE_cachefile.h BKE_camera.h @@ -293,12 +289,10 @@ set(SRC BKE_particle.h BKE_pbvh.h BKE_pointcache.h - BKE_property.h BKE_layer.h BKE_lightprobe.h BKE_report.h BKE_rigidbody.h - BKE_sca.h BKE_scene.h BKE_screen.h BKE_sequencer.h @@ -490,18 +484,6 @@ if(WITH_LZMA) add_definitions(-DWITH_LZMA) endif() -if(WITH_GAMEENGINE) - list(APPEND INC_SYS - ../../../extern/recastnavigation - ) - list(APPEND SRC - intern/navmesh_conversion.c - BKE_navmesh_conversion.h - ) - - add_definitions(-DWITH_GAMEENGINE) -endif() - if(WITH_LIBMV) add_definitions(-DWITH_LIBMV) endif() diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 879c4900146..bcdcdaa30cc 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -70,11 +70,6 @@ #include "BKE_deform.h" #include "BKE_global.h" /* For debug flag, DM_update_tessface_data() func. */ -#ifdef WITH_GAMEENGINE -#include "BKE_navmesh_conversion.h" -static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm); -#endif - #include "BLI_sys_types.h" /* for intptr_t support */ #include "GPU_buffers.h" @@ -1746,13 +1741,6 @@ static void dm_ensure_display_normals(DerivedMesh *dm) } } -/** - * new value for useDeform -1 (hack for the gameengine): - * - * - apply only the modifier stack of the object, skipping the virtual modifiers, - * - don't apply the key - * - apply deform modifiers and input vertexco - */ static void mesh_calc_modifiers( struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (*inputVertexCos)[3], const bool useRenderParams, int useDeform, @@ -1772,7 +1760,6 @@ static void mesh_calc_modifiers( int numVerts = me->totvert; const int required_mode = useRenderParams ? eModifierMode_Render : eModifierMode_Realtime; bool isPrevDeform = false; - const bool skipVirtualArmature = (useDeform < 0); MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0); const bool has_multires = (mmd && mmd->sculptlvl != 0); bool multires_applied = false; @@ -1806,17 +1793,7 @@ static void mesh_calc_modifiers( if (useDeform) deform_app_flags |= MOD_APPLY_USECACHE; - if (!skipVirtualArmature) { - firstmd = modifiers_getVirtualModifierList(ob, &virtualModifierData); - } - else { - /* game engine exception */ - firstmd = ob->modifiers.first; - if (firstmd && firstmd->type == eModifierType_Armature) - firstmd = firstmd->next; - } - - md = firstmd; + md = firstmd = modifiers_getVirtualModifierList(ob, &virtualModifierData); modifiers_clearErrors(ob); @@ -2246,20 +2223,6 @@ static void mesh_calc_modifiers( CustomData_free_layers(&finaldm->loopData, CD_NORMAL, finaldm->numLoopData); } -#ifdef WITH_GAMEENGINE - /* NavMesh - this is a hack but saves having a NavMesh modifier */ - if ((ob->gameflag & OB_NAVMESH) && (finaldm->type == DM_TYPE_CDDM)) { - DerivedMesh *tdm; - tdm = navmesh_dm_createNavMeshForVisualization(finaldm); - if (finaldm != tdm) { - finaldm->release(finaldm); - finaldm = tdm; - } - - DM_ensure_tessface(finaldm); - } -#endif /* WITH_GAMEENGINE */ - *r_final = finaldm; if (orcodm) @@ -2854,32 +2817,6 @@ DerivedMesh *mesh_create_derived_no_deform( return final; } -DerivedMesh *mesh_create_derived_no_virtual( - struct Depsgraph *depsgraph, Scene *scene, Object *ob, - float (*vertCos)[3], CustomDataMask dataMask) -{ - DerivedMesh *final; - - mesh_calc_modifiers( - depsgraph, scene, ob, vertCos, false, -1, false, dataMask, -1, false, false, false, - NULL, &final); - - return final; -} - -DerivedMesh *mesh_create_derived_physics( - struct Depsgraph *depsgraph, Scene *scene, Object *ob, - float (*vertCos)[3], CustomDataMask dataMask) -{ - DerivedMesh *final; - - mesh_calc_modifiers( - depsgraph, scene, ob, vertCos, false, -1, true, dataMask, -1, false, false, false, - NULL, &final); - - return final; -} - DerivedMesh *mesh_create_derived_no_deform_render( struct Depsgraph *depsgraph, Scene *scene, Object *ob, float (*vertCos)[3], @@ -3520,178 +3457,6 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm) ob->bb->flag &= ~BOUNDBOX_DIRTY; } -/* --- NAVMESH (begin) --- */ -#ifdef WITH_GAMEENGINE - -/* BMESH_TODO, navmesh is not working right currently - * All tools set this as MPoly data, but derived mesh currently draws from MFace (tessface) - * - * Proposed solution, rather then copy CD_RECAST into the MFace array, - * use ORIGINDEX to get the original poly index and then get the CD_RECAST - * data from the original me->mpoly layer. - campbell - */ - - -BLI_INLINE int navmesh_bit(int a, int b) -{ - return (a & (1 << b)) >> b; -} - -BLI_INLINE void navmesh_intToCol(int i, float col[3]) -{ - int r = navmesh_bit(i, 0) + navmesh_bit(i, 3) * 2 + 1; - int g = navmesh_bit(i, 1) + navmesh_bit(i, 4) * 2 + 1; - int b = navmesh_bit(i, 2) + navmesh_bit(i, 5) * 2 + 1; - col[0] = 1 - r * 63.0f / 255.0f; - col[1] = 1 - g * 63.0f / 255.0f; - col[2] = 1 - b * 63.0f / 255.0f; -} - -static void navmesh_drawColored(DerivedMesh *dm) -{ - MVert *mvert = (MVert *)CustomData_get_layer(&dm->vertData, CD_MVERT); - MFace *mface = (MFace *)CustomData_get_layer(&dm->faceData, CD_MFACE); - int *polygonIdx = (int *)CustomData_get_layer(&dm->polyData, CD_RECAST); - float col[3]; - - if (!polygonIdx) - return; - -#if 0 - //UI_ThemeColor(TH_WIRE); - glLineWidth(2.0); - dm->drawEdges(dm, 0, 1); -#endif - - Gwn_VertFormat *format = immVertexFormat(); - unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - - immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - - /* Note: batch drawing API would let us share vertices */ - immBeginAtMost(GWN_PRIM_TRIS, dm->numTessFaceData * 6); - for (int a = 0; a < dm->numTessFaceData; a++, mface++) { - int pi = polygonIdx[a]; - if (pi <= 0) { - zero_v3(col); - } - else { - navmesh_intToCol(pi, col); - } - - immSkipAttrib(color); - immVertex3fv(pos, mvert[mface->v1].co); - immSkipAttrib(color); - immVertex3fv(pos, mvert[mface->v2].co); - immAttrib3fv(color, col); - immVertex3fv(pos, mvert[mface->v3].co); - - if (mface->v4) { - /* this tess face is a quad, so draw the other triangle */ - immSkipAttrib(color); - immVertex3fv(pos, mvert[mface->v1].co); - immSkipAttrib(color); - immVertex3fv(pos, mvert[mface->v3].co); - immAttrib3fv(color, col); - immVertex3fv(pos, mvert[mface->v4].co); - } - } - immEnd(); - immUnbindProgram(); -} - -static void navmesh_DM_drawFacesSolid( - DerivedMesh *dm, - float (*partial_redraw_planes)[4], - bool UNUSED(fast), DMSetMaterial UNUSED(setMaterial)) -{ - UNUSED_VARS(partial_redraw_planes); - - //drawFacesSolid_original(dm, partial_redraw_planes, fast, setMaterial); - navmesh_drawColored(dm); -} - -static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm) -{ - DerivedMesh *result; - int maxFaces = dm->getNumPolys(dm); - int *recastData; - int vertsPerPoly = 0, nverts = 0, ndtris = 0, npolys = 0; - float *verts = NULL; - unsigned short *dtris = NULL, *dmeshes = NULL, *polys = NULL; - int *dtrisToPolysMap = NULL, *dtrisToTrisMap = NULL, *trisToFacesMap = NULL; - int res; - - result = CDDM_copy(dm); - if (!CustomData_has_layer(&result->polyData, CD_RECAST)) { - int *sourceRecastData = (int *)CustomData_get_layer(&dm->polyData, CD_RECAST); - if (sourceRecastData) { - CustomData_add_layer_named(&result->polyData, CD_RECAST, CD_DUPLICATE, - sourceRecastData, maxFaces, "recastData"); - } - } - recastData = (int *)CustomData_get_layer(&result->polyData, CD_RECAST); - - /* note: This is not good design! - really should not be doing this */ - result->drawFacesSolid = navmesh_DM_drawFacesSolid; - - - /* process mesh */ - res = buildNavMeshDataByDerivedMesh(dm, &vertsPerPoly, &nverts, &verts, &ndtris, &dtris, - &npolys, &dmeshes, &polys, &dtrisToPolysMap, &dtrisToTrisMap, - &trisToFacesMap); - if (res) { - size_t polyIdx; - - /* invalidate concave polygon */ - for (polyIdx = 0; polyIdx < (size_t)npolys; polyIdx++) { - unsigned short *poly = &polys[polyIdx * 2 * vertsPerPoly]; - if (!polyIsConvex(poly, vertsPerPoly, verts)) { - /* set negative polygon idx to all faces */ - unsigned short *dmesh = &dmeshes[4 * polyIdx]; - unsigned short tbase = dmesh[2]; - unsigned short tnum = dmesh[3]; - unsigned short ti; - - for (ti = 0; ti < tnum; ti++) { - unsigned short triidx = dtrisToTrisMap[tbase + ti]; - unsigned short faceidx = trisToFacesMap[triidx]; - if (recastData[faceidx] > 0) { - recastData[faceidx] = -recastData[faceidx]; - } - } - } - } - } - else { - printf("Navmesh: Unable to generate valid Navmesh"); - } - - /* clean up */ - if (verts != NULL) - MEM_freeN(verts); - if (dtris != NULL) - MEM_freeN(dtris); - if (dmeshes != NULL) - MEM_freeN(dmeshes); - if (polys != NULL) - MEM_freeN(polys); - if (dtrisToPolysMap != NULL) - MEM_freeN(dtrisToPolysMap); - if (dtrisToTrisMap != NULL) - MEM_freeN(dtrisToTrisMap); - if (trisToFacesMap != NULL) - MEM_freeN(trisToFacesMap); - - return result; -} - -#endif /* WITH_GAMEENGINE */ - -/* --- NAVMESH (end) --- */ - - void DM_init_origspace(DerivedMesh *dm) { const float default_osf[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index e47c87c995b..7cceec2c08f 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -855,39 +855,6 @@ void BKE_pose_free(bPose *pose) BKE_pose_free_ex(pose, true); } -static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan) -{ - bConstraint *pcon, *con; - - copy_v3_v3(pchan->loc, chan->loc); - copy_v3_v3(pchan->size, chan->size); - copy_v3_v3(pchan->eul, chan->eul); - copy_v3_v3(pchan->rotAxis, chan->rotAxis); - pchan->rotAngle = chan->rotAngle; - copy_qt_qt(pchan->quat, chan->quat); - pchan->rotmode = chan->rotmode; - copy_m4_m4(pchan->chan_mat, (float(*)[4])chan->chan_mat); - copy_m4_m4(pchan->pose_mat, (float(*)[4])chan->pose_mat); - pchan->flag = chan->flag; - - pchan->roll1 = chan->roll1; - pchan->roll2 = chan->roll2; - pchan->curveInX = chan->curveInX; - pchan->curveInY = chan->curveInY; - pchan->curveOutX = chan->curveOutX; - pchan->curveOutY = chan->curveOutY; - pchan->ease1 = chan->ease1; - pchan->ease2 = chan->ease2; - pchan->scaleIn = chan->scaleIn; - pchan->scaleOut = chan->scaleOut; - - con = chan->constraints.first; - for (pcon = pchan->constraints.first; pcon && con; pcon = pcon->next, con = con->next) { - pcon->enforce = con->enforce; - pcon->headtail = con->headtail; - } -} - /** * Copy the internal members of each pose channel including constraints * and ID-Props, used when duplicating bones in editmode. @@ -1329,25 +1296,6 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, /* ************** Pose Management Tools ****************** */ -/* Copy the data from the action-pose (src) into the pose */ -/* both args are assumed to be valid */ -/* exported to game engine */ -/* Note! this assumes both poses are aligned, this isn't always true when dealing with user poses */ -void extract_pose_from_pose(bPose *pose, const bPose *src) -{ - const bPoseChannel *schan; - bPoseChannel *pchan = pose->chanbase.first; - - if (pose == src) { - printf("extract_pose_from_pose source and target are the same\n"); - return; - } - - for (schan = src->chanbase.first; (schan && pchan); schan = schan->next, pchan = pchan->next) { - copy_pose_channel_data(pchan, schan); - } -} - /* for do_all_pose_actions, clears the pose. Now also exported for proxy and tools */ void BKE_pose_rest(bPose *pose) { diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 8d61b6723c6..74e6c996329 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -578,7 +578,7 @@ WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepat bool BKE_blendfile_workspace_config_write(Main *bmain, const char *filepath, ReportList *reports) { - int fileflags = G.fileflags & ~(G_FILE_NO_UI | G_FILE_AUTOPLAY | G_FILE_HISTORY); + int fileflags = G.fileflags & ~(G_FILE_NO_UI | G_FILE_HISTORY); bool retval = false; BKE_blendfile_write_partial_begin(bmain); diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c deleted file mode 100644 index c16c0f7af31..00000000000 --- a/source/blender/blenkernel/intern/bullet.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) Blender Foundation - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/blenkernel/intern/bullet.c - * \ingroup bke - */ - - -#include "MEM_guardedalloc.h" - -/* types */ -#include "DNA_object_force_types.h" /* here is the softbody struct */ - -#include "BKE_bullet.h" - - -/* ************ Object level, exported functions *************** */ - -/* allocates and initializes general main data */ -BulletSoftBody *bsbNew(void) -{ - BulletSoftBody *bsb; - - bsb = MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody"); - - bsb->flag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT; - bsb->linStiff = 0.5f; - bsb->angStiff = 1.0f; - bsb->volume = 1.0f; - - - bsb->viterations = 0; - bsb->piterations = 2; - bsb->diterations = 0; - bsb->citerations = 4; - - bsb->kSRHR_CL = 0.1f; - bsb->kSKHR_CL = 1.f; - bsb->kSSHR_CL = 0.5f; - bsb->kSR_SPLT_CL = 0.5f; - - bsb->kSK_SPLT_CL = 0.5f; - bsb->kSS_SPLT_CL = 0.5f; - bsb->kVCF = 1; - bsb->kDP = 0; - - bsb->kDG = 0; - bsb->kLF = 0; - bsb->kPR = 0; - bsb->kVC = 0; - - bsb->kDF = 0.2f; - bsb->kMT = 0.05; - bsb->kCHR = 1.0f; - bsb->kKHR = 0.1f; - - bsb->kSHR = 1.0f; - bsb->kAHR = 0.7f; - - bsb->collisionflags = 0; - //bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS; - bsb->numclusteriterations = 64; - bsb->welding = 0.f; - - return bsb; -} - -/* frees all */ -void bsbFree(BulletSoftBody *bsb) -{ - /* no internal data yet */ - MEM_freeN(bsb); -} - - diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index eca789b0f87..b58028b4a5d 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3028,66 +3028,6 @@ static bConstraintTypeInfo CTI_MINMAX = { minmax_evaluate /* evaluate */ }; -/* ------- RigidBody Joint ---------- */ - -static void rbj_new_data(void *cdata) -{ - bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)cdata; - - /* removed code which set target of this constraint */ - data->type = 1; -} - -static void rbj_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) -{ - bRigidBodyJointConstraint *data = con->data; - - /* target only */ - func(con, (ID **)&data->tar, false, userdata); - func(con, (ID **)&data->child, false, userdata); -} - -static int rbj_get_tars(bConstraint *con, ListBase *list) -{ - if (con && list) { - bRigidBodyJointConstraint *data = con->data; - bConstraintTarget *ct; - - /* standard target-getting macro for single-target constraints without subtargets */ - SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); - - return 1; - } - - return 0; -} - -static void rbj_flush_tars(bConstraint *con, ListBase *list, bool no_copy) -{ - if (con && list) { - bRigidBodyJointConstraint *data = con->data; - bConstraintTarget *ct = list->first; - - /* the following macro is used for all standard single-target constraints */ - SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy); - } -} - -static bConstraintTypeInfo CTI_RIGIDBODYJOINT = { - CONSTRAINT_TYPE_RIGIDBODYJOINT, /* type */ - sizeof(bRigidBodyJointConstraint), /* size */ - "Rigid Body Joint", /* name */ - "bRigidBodyJointConstraint", /* struct name */ - NULL, /* free data */ - rbj_id_looper, /* id looper */ - NULL, /* copy data */ - rbj_new_data, /* new data */ - rbj_get_tars, /* get constraint targets */ - rbj_flush_tars, /* flush constraint targets */ - default_get_tarmat, /* get target matrix */ - NULL /* evaluate - this is not solved here... is just an interface for game-engine */ -}; - /* -------- Clamp To ---------- */ static void clampto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) @@ -4438,7 +4378,7 @@ static void constraints_init_typeinfo(void) constraintsTypeInfo[14] = &CTI_DISTLIMIT; /* Limit Distance Constraint */ constraintsTypeInfo[15] = &CTI_STRETCHTO; /* StretchTo Constaint */ constraintsTypeInfo[16] = &CTI_MINMAX; /* Floor Constraint */ - constraintsTypeInfo[17] = &CTI_RIGIDBODYJOINT; /* RigidBody Constraint */ + /* constraintsTypeInfo[17] = &CTI_RIGIDBODYJOINT; */ /* RigidBody Constraint - Deprecated */ constraintsTypeInfo[18] = &CTI_CLAMPTO; /* ClampTo Constraint */ constraintsTypeInfo[19] = &CTI_TRANSFORM; /* Transformation Constraint */ constraintsTypeInfo[20] = &CTI_SHRINKWRAP; /* Shrinkwrap Constraint */ diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 2bb12725940..351e43706dd 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -791,14 +791,6 @@ struct SpaceNode *CTX_wm_space_node(const bContext *C) return NULL; } -struct SpaceLogic *CTX_wm_space_logic(const bContext *C) -{ - ScrArea *sa = CTX_wm_area(C); - if (sa && sa->spacetype == SPACE_LOGIC) - return sa->spacedata.first; - return NULL; -} - struct SpaceIpo *CTX_wm_space_graph(const bContext *C) { ScrArea *sa = CTX_wm_area(C); diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index fcbc25ebad5..c2e9af685a6 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -46,7 +46,6 @@ /* since we have versioning code here */ #define DNA_DEPRECATED_ALLOW -#include "DNA_actuator_types.h" #include "DNA_anim_types.h" #include "DNA_constraint_types.h" #include "DNA_camera_types.h" @@ -1768,23 +1767,6 @@ void do_versions_ipos_to_animato(Main *main) ipo_to_animdata(id, ob->ipo, NULL, NULL, NULL); id_us_min(&ob->ipo->id); ob->ipo = NULL; - - { - /* If we have any empty action actuators, assume they were - * converted IPO Actuators using the object IPO */ - bActuator *act; - bActionActuator *aa; - - for (act = ob->actuators.first; act; act = act->next) { - /* Any actuators set to ACT_IPO at this point are actually Action Actuators that - * need this converted IPO to finish converting the actuator. */ - if (act->type == ACT_IPO) { - aa = (bActionActuator *)act->data; - aa->act = ob->adt->action; - act->type = ACT_ACTION; - } - } - } } } diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index bed2244702f..28e2201ccfa 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -31,13 +31,11 @@ #include "MEM_guardedalloc.h" -#include "DNA_actuator_types.h" #include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_brush_types.h" #include "DNA_camera_types.h" #include "DNA_constraint_types.h" -#include "DNA_controller_types.h" #include "DNA_group_types.h" #include "DNA_gpencil_types.h" #include "DNA_key_types.h" @@ -55,7 +53,6 @@ #include "DNA_lightprobe_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" -#include "DNA_sensor_types.h" #include "DNA_sequence_types.h" #include "DNA_screen_types.h" #include "DNA_speaker_types.h" @@ -84,7 +81,6 @@ #include "BKE_node.h" #include "BKE_particle.h" #include "BKE_rigidbody.h" -#include "BKE_sca.h" #include "BKE_sequencer.h" #include "BKE_tracking.h" #include "BKE_workspace.h" @@ -219,33 +215,6 @@ static void library_foreach_particlesystemsObjectLooper( FOREACH_FINALIZE_VOID; } -static void library_foreach_sensorsObjectLooper( - bSensor *UNUSED(sensor), ID **id_pointer, void *user_data, int cb_flag) -{ - LibraryForeachIDData *data = (LibraryForeachIDData *) user_data; - FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pointer, cb_flag); - - FOREACH_FINALIZE_VOID; -} - -static void library_foreach_controllersObjectLooper( - bController *UNUSED(controller), ID **id_pointer, void *user_data, int cb_flag) -{ - LibraryForeachIDData *data = (LibraryForeachIDData *) user_data; - FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pointer, cb_flag); - - FOREACH_FINALIZE_VOID; -} - -static void library_foreach_actuatorsObjectLooper( - bActuator *UNUSED(actuator), ID **id_pointer, void *user_data, int cb_flag) -{ - LibraryForeachIDData *data = (LibraryForeachIDData *) user_data; - FOREACH_CALLBACK_INVOKE_ID_PP(data, id_pointer, cb_flag); - - FOREACH_FINALIZE_VOID; -} - static void library_foreach_nla_strip(LibraryForeachIDData *data, NlaStrip *strip) { NlaStrip *substrip; @@ -506,8 +475,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call BKE_rigidbody_world_id_loop(scene->rigidbody_world, library_foreach_rigidbodyworldSceneLooper, &data); } - CALLBACK_INVOKE(scene->gm.dome.warptext, IDWALK_CB_NOP); - break; } @@ -605,10 +572,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call CALLBACK_INVOKE(object->soft->effector_weights->group, IDWALK_CB_NOP); } } - - BKE_sca_sensors_id_loop(&object->sensors, library_foreach_sensorsObjectLooper, &data); - BKE_sca_controllers_id_loop(&object->controllers, library_foreach_controllersObjectLooper, &data); - BKE_sca_actuators_id_loop(&object->actuators, library_foreach_actuatorsObjectLooper, &data); break; } @@ -1084,7 +1047,7 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used) #if 0 return ELEM(id_type_used, ID_ME, ID_CU, ID_MB, ID_LT, ID_SPK, ID_AR, ID_LA, ID_CA, /* obdata */ ID_OB, ID_MA, ID_GD, ID_GR, ID_TE, ID_PA, ID_TXT, ID_SO, ID_MC, ID_IM, ID_AC - /* + constraints, modifiers and game logic ID types... */); + /* + constraints and modifiers ... */); #else return true; #endif diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 483500cf67d..f6e03fec380 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -104,7 +104,6 @@ #include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_lightprobe.h" -#include "BKE_sca.h" #include "BKE_speaker.h" #include "BKE_sound.h" #include "BKE_screen.h" @@ -506,10 +505,6 @@ ATTR_NONNULL(1) static void libblock_remap_data( } } - if (old_id && GS(old_id->name) == ID_OB) { - BKE_sca_logic_links_remap(bmain, (Object *)old_id, (Object *)new_id); - } - /* XXX We may not want to always 'transfer' fakeuser from old to new id... Think for now it's desired behavior * though, we can always add an option (flag) to control this later if needed. */ if (old_id && (old_id->flag & LIB_FAKEUSER)) { diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index f80f726607b..fee91865d35 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -200,11 +200,7 @@ void BKE_material_init(Material *ma) ma->vol.ms_spread = 0.2f; ma->vol.ms_diff = 1.f; ma->vol.ms_intensity = 1.f; - - ma->game.flag = GEMAT_BACKCULL; - ma->game.alpha_blend = 0; - ma->game.face_orientation = 0; - + ma->mode = MA_TRACEBLE | MA_SHADBUF | MA_SHADOW | MA_RAYBIAS | MA_TANGENT_STR | MA_ZTRANSP; ma->mode2 = MA_CASTSHADOW; ma->shade_flag = MA_APPROX_OCCLUSION; @@ -1285,7 +1281,7 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma) short index = 0, i; bool use_nodes = BKE_scene_use_new_shading_nodes(scene); - bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene); + bool is_bi = BKE_scene_uses_blender_internal(scene); /* XXX, for 2.8 testing & development its useful to have non Cycles/BI engines use material nodes * In the future we may have some way to check this which each engine can define. diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c deleted file mode 100644 index 35bcca52f63..00000000000 --- a/source/blender/blenkernel/intern/navmesh_conversion.c +++ /dev/null @@ -1,502 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/blenkernel/intern/navmesh_conversion.c - * \ingroup bke - */ - -#include <math.h> -#include <stdlib.h> - -#include "MEM_guardedalloc.h" - -#include "DNA_meshdata_types.h" - -#include "BLI_utildefines.h" -#include "BLI_math.h" -#include "BLI_sort.h" - -#include "BKE_navmesh_conversion.h" -#include "BKE_cdderivedmesh.h" - -#include "recast-capi.h" - -BLI_INLINE float area2(const float *a, const float *b, const float *c) -{ - return (b[0] - a[0]) * (c[2] - a[2]) - (c[0] - a[0]) * (b[2] - a[2]); -} - -BLI_INLINE int left(const float *a, const float *b, const float *c) -{ - return area2(a, b, c) < 0; -} - -int polyNumVerts(const unsigned short *p, const int vertsPerPoly) -{ - int i, nv = 0; - for (i = 0; i < vertsPerPoly; i++) { - if (p[i] == 0xffff) - break; - nv++; - } - return nv; -} - -int polyIsConvex(const unsigned short *p, const int vertsPerPoly, const float *verts) -{ - int j, nv = polyNumVerts(p, vertsPerPoly); - if (nv < 3) - return 0; - for (j = 0; j < nv; j++) { - const float *v = &verts[3 * p[j]]; - const float *v_next = &verts[3 * p[(j + 1) % nv]]; - const float *v_prev = &verts[3 * p[(nv + j - 1) % nv]]; - if (!left(v_prev, v, v_next)) - return 0; - - } - return 1; -} - -/* XXX, could replace with #dist_to_line_segment_v3(), or add a squared version */ -float distPointToSegmentSq(const float point[3], const float a[3], const float b[3]) -{ - float abx[3], dx[3]; - float d, t; - - sub_v3_v3v3(abx, b, a); - sub_v3_v3v3(dx, point, a); - - d = abx[0] * abx[0] + abx[2] * abx[2]; - t = abx[0] * dx[0] + abx[2] * dx[2]; - - if (d > 0.0f) - t /= d; - if (t < 0.0f) - t = 0.0f; - else if (t > 1.0f) - t = 1.0f; - dx[0] = a[0] + t * abx[0] - point[0]; - dx[2] = a[2] + t * abx[2] - point[2]; - - return dx[0] * dx[0] + dx[2] * dx[2]; -} - -int buildRawVertIndicesData(DerivedMesh *dm, int *nverts_r, float **verts_r, - int *ntris_r, unsigned short **tris_r, int **trisToFacesMap_r, - int **recastData) -{ - int vi, fi, triIdx; - int nverts, ntris; - int *trisToFacesMap; - float *verts; - unsigned short *tris, *tri; - int nfaces; - MFace *faces; - - nverts = dm->getNumVerts(dm); - if (nverts >= 0xffff) { - printf("Converting navmesh: Error! Too many vertices. Max number of vertices %d\n", 0xffff); - return 0; - } - if (nverts == 0) { - printf("Converting navmesh: Error! There are no vertices!\n"); - return 0; - } - - verts = MEM_mallocN(sizeof(float[3]) * nverts, "buildRawVertIndicesData verts"); - dm->getVertCos(dm, (float(*)[3])verts); - - /* flip coordinates */ - for (vi = 0; vi < nverts; vi++) { - SWAP(float, verts[3 * vi + 1], verts[3 * vi + 2]); - } - - /* calculate number of tris */ - dm->recalcTessellation(dm); - nfaces = dm->getNumTessFaces(dm); - if (nfaces == 0) { - printf("Converting navmesh: Error! There are %i vertices, but no faces!\n", nverts); - return 0; - } - - faces = dm->getTessFaceArray(dm); - ntris = nfaces; - for (fi = 0; fi < nfaces; fi++) { - MFace *face = &faces[fi]; - if (face->v4) - ntris++; - } - - /* copy and transform to triangles (reorder on the run) */ - trisToFacesMap = MEM_callocN(sizeof(int) * ntris, "buildRawVertIndicesData trisToFacesMap"); - tris = MEM_callocN(sizeof(unsigned short) * 3 * ntris, "buildRawVertIndicesData tris"); - tri = tris; - triIdx = 0; - for (fi = 0; fi < nfaces; fi++) { - MFace *face = &faces[fi]; - tri[3 * triIdx + 0] = (unsigned short) face->v1; - tri[3 * triIdx + 1] = (unsigned short) face->v3; - tri[3 * triIdx + 2] = (unsigned short) face->v2; - trisToFacesMap[triIdx++] = fi; - if (face->v4) { - tri[3 * triIdx + 0] = (unsigned short) face->v1; - tri[3 * triIdx + 1] = (unsigned short) face->v4; - tri[3 * triIdx + 2] = (unsigned short) face->v3; - trisToFacesMap[triIdx++] = fi; - } - } - - /* carefully, recast data is just reference to data in derived mesh */ - *recastData = (int *)CustomData_get_layer(&dm->polyData, CD_RECAST); - - *nverts_r = nverts; - *verts_r = verts; - *ntris_r = ntris; - *tris_r = tris; - *trisToFacesMap_r = trisToFacesMap; - - return 1; -} - -int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys, - unsigned short *polys, const unsigned short *dmeshes, - const float *verts, const unsigned short *dtris, - const int *dtrisToPolysMap) -{ - int polyidx; - int capacity = vertsPerPoly; - unsigned short *newPoly = MEM_callocN(sizeof(unsigned short) * capacity, "buildPolygonsByDetailedMeshes newPoly"); - memset(newPoly, 0xff, sizeof(unsigned short) * capacity); - - for (polyidx = 0; polyidx < npolys; polyidx++) { - size_t i; - int j, k; - int nv = 0; - /* search border */ - int tri, btri = -1; - int edge, bedge = -1; - int dtrisNum = dmeshes[polyidx * 4 + 3]; - int dtrisBase = dmeshes[polyidx * 4 + 2]; - unsigned char *traversedTris = MEM_callocN(sizeof(unsigned char) * dtrisNum, "buildPolygonsByDetailedMeshes traversedTris"); - unsigned short *adjustedPoly; - int adjustedNv; - int allBorderTraversed; - - for (j = 0; j < dtrisNum && btri == -1; j++) { - int curpolytri = dtrisBase + j; - for (k = 0; k < 3; k++) { - unsigned short neighbortri = dtris[curpolytri * 3 * 2 + 3 + k]; - if (neighbortri == 0xffff || dtrisToPolysMap[neighbortri] != polyidx + 1) { - btri = curpolytri; - bedge = k; - break; - } - } - } - if (btri == -1 || bedge == -1) { - /* can't find triangle with border edge */ - MEM_freeN(traversedTris); - MEM_freeN(newPoly); - - return 0; - } - - newPoly[nv++] = dtris[btri * 3 * 2 + bedge]; - tri = btri; - edge = (bedge + 1) % 3; - traversedTris[tri - dtrisBase] = 1; - while (tri != btri || edge != bedge) { - int neighbortri = dtris[tri * 3 * 2 + 3 + edge]; - if (neighbortri == 0xffff || dtrisToPolysMap[neighbortri] != polyidx + 1) { - if (nv == capacity) { - unsigned short *newPolyBig; - capacity += vertsPerPoly; - newPolyBig = MEM_callocN(sizeof(unsigned short) * capacity, "buildPolygonsByDetailedMeshes newPolyBig"); - memset(newPolyBig, 0xff, sizeof(unsigned short) * capacity); - memcpy(newPolyBig, newPoly, sizeof(unsigned short) * nv); - MEM_freeN(newPoly); - newPoly = newPolyBig; - } - newPoly[nv++] = dtris[tri * 3 * 2 + edge]; - /* move to next edge */ - edge = (edge + 1) % 3; - } - else { - /* move to next tri */ - int twinedge = -1; - for (k = 0; k < 3; k++) { - if (dtris[neighbortri * 3 * 2 + 3 + k] == tri) { - twinedge = k; - break; - } - } - if (twinedge == -1) { - printf("Converting navmesh: Error! Can't find neighbor edge - invalid adjacency info\n"); - MEM_freeN(traversedTris); - goto returnLabel; - } - tri = neighbortri; - edge = (twinedge + 1) % 3; - traversedTris[tri - dtrisBase] = 1; - } - } - - adjustedPoly = MEM_callocN(sizeof(unsigned short) * nv, "buildPolygonsByDetailedMeshes adjustedPoly"); - adjustedNv = 0; - for (i = 0; i < nv; i++) { - unsigned short prev = newPoly[(nv + i - 1) % nv]; - unsigned short cur = newPoly[i]; - unsigned short next = newPoly[(i + 1) % nv]; - float distSq = distPointToSegmentSq(&verts[3 * cur], &verts[3 * prev], &verts[3 * next]); - static const float tolerance = 0.001f; - if (distSq > tolerance) - adjustedPoly[adjustedNv++] = cur; - } - memcpy(newPoly, adjustedPoly, adjustedNv * sizeof(unsigned short)); - MEM_freeN(adjustedPoly); - nv = adjustedNv; - - allBorderTraversed = 1; - for (i = 0; i < dtrisNum; i++) { - if (traversedTris[i] == 0) { - /* check whether it has border edges */ - int curpolytri = dtrisBase + i; - for (k = 0; k < 3; k++) { - unsigned short neighbortri = dtris[curpolytri * 3 * 2 + 3 + k]; - if (neighbortri == 0xffff || dtrisToPolysMap[neighbortri] != polyidx + 1) { - allBorderTraversed = 0; - break; - } - } - } - } - - if (nv <= vertsPerPoly && allBorderTraversed) { - for (i = 0; i < nv; i++) { - polys[polyidx * vertsPerPoly * 2 + i] = newPoly[i]; - } - } - - MEM_freeN(traversedTris); - } - -returnLabel: - MEM_freeN(newPoly); - - return 1; -} - -struct SortContext { - const int *recastData; - const int *trisToFacesMap; -}; - -static int compareByData(const void *a, const void *b, void *ctx) -{ - return (((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int *)a]] - - ((struct SortContext *)ctx)->recastData[((struct SortContext *)ctx)->trisToFacesMap[*(int *)b]]); -} - -int buildNavMeshData(const int nverts, const float *verts, - const int ntris, const unsigned short *tris, - const int *recastData, const int *trisToFacesMap, - int *ndtris_r, unsigned short **dtris_r, - int *npolys_r, unsigned short **dmeshes_r, unsigned short **polys_r, - int *vertsPerPoly_r, int **dtrisToPolysMap_r, int **dtrisToTrisMap_r) - -{ - int *trisMapping; - int i; - struct SortContext context; - int validTriStart, prevPolyIdx, curPolyIdx, newPolyIdx, prevpolyidx; - unsigned short *dmesh; - - int ndtris, npolys, vertsPerPoly; - unsigned short *dtris, *dmeshes, *polys; - int *dtrisToPolysMap, *dtrisToTrisMap; - - if (!recastData) { - printf("Converting navmesh: Error! Can't find recast custom data\n"); - return 0; - } - - trisMapping = MEM_callocN(sizeof(int) * ntris, "buildNavMeshData trisMapping"); - - /* sort the triangles by polygon idx */ - for (i = 0; i < ntris; i++) - trisMapping[i] = i; - context.recastData = recastData; - context.trisToFacesMap = trisToFacesMap; - BLI_qsort_r(trisMapping, ntris, sizeof(int), compareByData, &context); - - /* search first valid triangle - triangle of convex polygon */ - validTriStart = -1; - for (i = 0; i < ntris; i++) { - if (recastData[trisToFacesMap[trisMapping[i]]] > 0) { - validTriStart = i; - break; - } - } - - if (validTriStart < 0) { - printf("Converting navmesh: Error! No valid polygons in mesh\n"); - MEM_freeN(trisMapping); - return 0; - } - - ndtris = ntris - validTriStart; - /* fill dtris to faces mapping */ - dtrisToTrisMap = MEM_callocN(sizeof(int) * ndtris, "buildNavMeshData dtrisToTrisMap"); - memcpy(dtrisToTrisMap, &trisMapping[validTriStart], ndtris * sizeof(int)); - MEM_freeN(trisMapping); - - /* create detailed mesh triangles - copy only valid triangles - * and reserve memory for adjacency info */ - dtris = MEM_callocN(sizeof(unsigned short) * 3 * 2 * ndtris, "buildNavMeshData dtris"); - memset(dtris, 0xff, sizeof(unsigned short) * 3 * 2 * ndtris); - for (i = 0; i < ndtris; i++) { - memcpy(dtris + 3 * 2 * i, tris + 3 * dtrisToTrisMap[i], sizeof(unsigned short) * 3); - } - - /* create new recast data corresponded to dtris and renumber for continuous indices */ - prevPolyIdx = -1; - newPolyIdx = 0; - dtrisToPolysMap = MEM_callocN(sizeof(int) * ndtris, "buildNavMeshData dtrisToPolysMap"); - for (i = 0; i < ndtris; i++) { - curPolyIdx = recastData[trisToFacesMap[dtrisToTrisMap[i]]]; - if (curPolyIdx != prevPolyIdx) { - newPolyIdx++; - prevPolyIdx = curPolyIdx; - } - dtrisToPolysMap[i] = newPolyIdx; - } - - - /* build adjacency info for detailed mesh triangles */ - if (!recast_buildMeshAdjacency(dtris, ndtris, nverts, 3)) { - printf("Converting navmesh: Error! Unable to build mesh adjacency information\n"); - MEM_freeN(trisMapping); - MEM_freeN(dtrisToPolysMap); - return 0; - } - - /* create detailed mesh description for each navigation polygon */ - npolys = dtrisToPolysMap[ndtris - 1]; - dmeshes = MEM_callocN(sizeof(unsigned short) * npolys * 4, "buildNavMeshData dmeshes"); - memset(dmeshes, 0, npolys * 4 * sizeof(unsigned short)); - dmesh = NULL; - prevpolyidx = 0; - for (i = 0; i < ndtris; i++) { - int curpolyidx = dtrisToPolysMap[i]; - if (curpolyidx != prevpolyidx) { - if (curpolyidx != prevpolyidx + 1) { - printf("Converting navmesh: Error! Wrong order of detailed mesh faces\n"); - goto fail; - } - dmesh = dmesh == NULL ? dmeshes : dmesh + 4; - dmesh[2] = (unsigned short)i; /* tbase */ - dmesh[3] = 0; /* tnum */ - prevpolyidx = curpolyidx; - } - dmesh[3]++; - } - - /* create navigation polygons */ - vertsPerPoly = 6; - polys = MEM_callocN(sizeof(unsigned short) * npolys * vertsPerPoly * 2, "buildNavMeshData polys"); - memset(polys, 0xff, sizeof(unsigned short) * vertsPerPoly * 2 * npolys); - - if (!buildPolygonsByDetailedMeshes(vertsPerPoly, npolys, polys, dmeshes, verts, dtris, dtrisToPolysMap)) { - printf("Converting navmesh: Error! Unable to build polygons from detailed mesh\n"); - goto fail; - } - - *ndtris_r = ndtris; - *npolys_r = npolys; - *vertsPerPoly_r = vertsPerPoly; - *dtris_r = dtris; - *dmeshes_r = dmeshes; - *polys_r = polys; - *dtrisToPolysMap_r = dtrisToPolysMap; - *dtrisToTrisMap_r = dtrisToTrisMap; - - return 1; - -fail: - MEM_freeN(dmeshes); - MEM_freeN(dtrisToPolysMap); - MEM_freeN(dtrisToTrisMap); - return 0; -} - - -int buildNavMeshDataByDerivedMesh(DerivedMesh *dm, int *vertsPerPoly, - int *nverts, float **verts, - int *ndtris, unsigned short **dtris, - int *npolys, unsigned short **dmeshes, - unsigned short **polys, int **dtrisToPolysMap, - int **dtrisToTrisMap, int **trisToFacesMap) -{ - int res; - int ntris = 0, *recastData = NULL; - unsigned short *tris = NULL; - - res = buildRawVertIndicesData(dm, nverts, verts, &ntris, &tris, trisToFacesMap, &recastData); - if (!res) { - printf("Converting navmesh: Error! Can't get raw vertices and indices from mesh\n"); - goto exit; - } - - res = buildNavMeshData(*nverts, *verts, ntris, tris, recastData, *trisToFacesMap, - ndtris, dtris, npolys, dmeshes, polys, vertsPerPoly, - dtrisToPolysMap, dtrisToTrisMap); - if (!res) { - printf("Converting navmesh: Error! Can't build navmesh data from mesh\n"); - goto exit; - } - -exit: - if (tris) - MEM_freeN(tris); - - return res; -} - -int polyFindVertex(const unsigned short *p, const int vertsPerPoly, unsigned short vertexIdx) -{ - int i, res = -1; - for (i = 0; i < vertsPerPoly; i++) { - if (p[i] == 0xffff) - break; - if (p[i] == vertexIdx) { - res = i; - break; - } - } - return res; -} diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 8b6ae075f9c..addf84224ac 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -59,7 +59,6 @@ #include "DNA_world_types.h" #include "DNA_object_types.h" #include "DNA_lightprobe_types.h" -#include "DNA_property_types.h" #include "DNA_rigidbody_types.h" #include "BLI_blenlib.h" @@ -77,7 +76,6 @@ #include "BKE_idprop.h" #include "BKE_armature.h" #include "BKE_action.h" -#include "BKE_bullet.h" #include "BKE_deform.h" #include "BKE_DerivedMesh.h" #include "BKE_animsys.h" @@ -109,9 +107,7 @@ #include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_lightprobe.h" -#include "BKE_property.h" #include "BKE_rigidbody.h" -#include "BKE_sca.h" #include "BKE_scene.h" #include "BKE_sequencer.h" #include "BKE_speaker.h" @@ -176,14 +172,6 @@ void BKE_object_free_softbody(Object *ob) } } -void BKE_object_free_bulletsoftbody(Object *ob) -{ - if (ob->bsoft) { - bsbFree(ob->bsoft); - ob->bsoft = NULL; - } -} - void BKE_object_free_curve_cache(Object *ob) { if (ob->curve_cache) { @@ -436,11 +424,6 @@ void BKE_object_free(Object *ob) animviz_free_motionpath(ob->mpath); ob->mpath = NULL; } - BKE_bproperty_free_list(&ob->prop); - - free_sensors(&ob->sensors); - free_controllers(&ob->controllers); - free_actuators(&ob->actuators); BKE_constraints_free_ex(&ob->constraints, false); @@ -452,10 +435,6 @@ void BKE_object_free(Object *ob) sbFree(ob->soft); ob->soft = NULL; } - if (ob->bsoft) { - bsbFree(ob->bsoft); - ob->bsoft = NULL; - } GPU_lamp_free(ob); for (ObjectEngineData *oed = ob->drawdata.first; oed; oed = oed->next) { @@ -722,23 +701,6 @@ void BKE_object_init(Object *ob) ob->dupsta = 1; ob->dupend = 100; ob->dupfacesca = 1.0; - /* Game engine defaults*/ - ob->mass = ob->inertia = 1.0f; - ob->formfactor = 0.4f; - ob->damping = 0.04f; - ob->rdamping = 0.1f; - ob->anisotropicFriction[0] = 1.0f; - ob->anisotropicFriction[1] = 1.0f; - ob->anisotropicFriction[2] = 1.0f; - ob->gameflag = OB_PROP | OB_COLLISION; - ob->margin = 0.04f; - ob->init_state = 1; - ob->state = 1; - ob->obstacleRad = 1.0f; - ob->step_height = 0.15f; - ob->jump_speed = 10.0f; - ob->fall_speed = 55.0f; - ob->max_jumps = 1; ob->col_group = 0x01; ob->col_mask = 0xffff; ob->preview = NULL; @@ -834,139 +796,6 @@ Object *BKE_object_add_from( return ob; } -#ifdef WITH_GAMEENGINE - -void BKE_object_lod_add(Object *ob) -{ - LodLevel *lod = MEM_callocN(sizeof(LodLevel), "LoD Level"); - LodLevel *last = ob->lodlevels.last; - - /* If the lod list is empty, initialize it with the base lod level */ - if (!last) { - LodLevel *base = MEM_callocN(sizeof(LodLevel), "Base LoD Level"); - BLI_addtail(&ob->lodlevels, base); - base->flags = OB_LOD_USE_MESH | OB_LOD_USE_MAT; - base->source = ob; - base->obhysteresis = 10; - last = ob->currentlod = base; - } - - lod->distance = last->distance + 25.0f; - lod->obhysteresis = 10; - lod->flags = OB_LOD_USE_MESH | OB_LOD_USE_MAT; - - BLI_addtail(&ob->lodlevels, lod); -} - -static int lod_cmp(const void *a, const void *b) -{ - const LodLevel *loda = a; - const LodLevel *lodb = b; - - if (loda->distance < lodb->distance) return -1; - return loda->distance > lodb->distance; -} - -void BKE_object_lod_sort(Object *ob) -{ - BLI_listbase_sort(&ob->lodlevels, lod_cmp); -} - -bool BKE_object_lod_remove(Object *ob, int level) -{ - LodLevel *rem; - - if (level < 1 || level > BLI_listbase_count(&ob->lodlevels) - 1) - return false; - - rem = BLI_findlink(&ob->lodlevels, level); - - if (rem == ob->currentlod) { - ob->currentlod = rem->prev; - } - - BLI_remlink(&ob->lodlevels, rem); - MEM_freeN(rem); - - /* If there are no user defined lods, remove the base lod as well */ - if (BLI_listbase_is_single(&ob->lodlevels)) { - LodLevel *base = ob->lodlevels.first; - BLI_remlink(&ob->lodlevels, base); - MEM_freeN(base); - ob->currentlod = NULL; - } - - return true; -} - -static LodLevel *lod_level_select(Object *ob, const float camera_position[3]) -{ - LodLevel *current = ob->currentlod; - float dist_sq; - - if (!current) return NULL; - - dist_sq = len_squared_v3v3(ob->obmat[3], camera_position); - - if (dist_sq < SQUARE(current->distance)) { - /* check for higher LoD */ - while (current->prev && dist_sq < SQUARE(current->distance)) { - current = current->prev; - } - } - else { - /* check for lower LoD */ - while (current->next && dist_sq > SQUARE(current->next->distance)) { - current = current->next; - } - } - - return current; -} - -bool BKE_object_lod_is_usable(Object *ob, ViewLayer *view_layer) -{ - bool active = (view_layer) ? ob == OBACT(view_layer) : false; - return (ob->mode == OB_MODE_OBJECT || !active); -} - -void BKE_object_lod_update(Object *ob, const float camera_position[3]) -{ - LodLevel *cur_level = ob->currentlod; - LodLevel *new_level = lod_level_select(ob, camera_position); - - if (new_level != cur_level) { - ob->currentlod = new_level; - } -} - -static Object *lod_ob_get(Object *ob, ViewLayer *view_layer, int flag) -{ - LodLevel *current = ob->currentlod; - - if (!current || !BKE_object_lod_is_usable(ob, view_layer)) - return ob; - - while (current->prev && (!(current->flags & flag) || !current->source || current->source->type != OB_MESH)) { - current = current->prev; - } - - return current->source; -} - -struct Object *BKE_object_lod_meshob_get(Object *ob, ViewLayer *view_layer) -{ - return lod_ob_get(ob, view_layer, OB_LOD_USE_MESH); -} - -struct Object *BKE_object_lod_matob_get(Object *ob, ViewLayer *view_layer) -{ - return lod_ob_get(ob, view_layer, OB_LOD_USE_MAT); -} - -#endif /* WITH_GAMEENGINE */ - - SoftBody *copy_softbody(const SoftBody *sb, const int flag) { SoftBody *sbn; @@ -1012,17 +841,6 @@ SoftBody *copy_softbody(const SoftBody *sb, const int flag) return sbn; } -BulletSoftBody *copy_bulletsoftbody(const BulletSoftBody *bsb, const int UNUSED(flag)) -{ - BulletSoftBody *bsbn; - - if (bsb == NULL) - return NULL; - bsbn = MEM_dupallocN(bsb); - /* no pointer in this structure yet */ - return bsbn; -} - ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int flag) { ParticleSystem *psysn; @@ -1356,11 +1174,6 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ BLI_addtail(&ob_dst->modifiers, nmd); } - BLI_listbase_clear(&ob_dst->prop); - BKE_bproperty_copy_list(&ob_dst->prop, &ob_src->prop); - - BKE_sca_logic_copy(ob_dst, ob_src, flag_subdata); - if (ob_src->pose) { copy_object_pose(ob_dst, ob_src, flag_subdata); /* backwards compat... non-armatures can get poses in older files? */ @@ -1381,7 +1194,6 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ } } ob_dst->soft = copy_softbody(ob_src->soft, flag_subdata); - ob_dst->bsoft = copy_bulletsoftbody(ob_src->bsoft, flag_subdata); ob_dst->rigidbody_object = BKE_rigidbody_copy_object(ob_src, flag_subdata); ob_dst->rigidbody_constraint = BKE_rigidbody_copy_constraint(ob_src, flag_subdata); @@ -2756,7 +2568,7 @@ typedef struct ObTfmBack { float obmat[4][4]; /* final worldspace matrix with constraints & animsys applied */ float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */ float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */ - float imat[4][4]; /* inverse matrix of 'obmat' for during render, old game engine, temporally: ipokeys of transform */ + float imat[4][4]; /* inverse matrix of 'obmat' for during render, temporally: ipokeys of transform */ } ObTfmBack; void *BKE_object_tfm_backup(Object *ob) diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c deleted file mode 100644 index b163f623d21..00000000000 --- a/source/blender/blenkernel/intern/property.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): ton roosendaal - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/blenkernel/intern/property.c - * \ingroup bke - * - * This module deals with bProperty only, - * they are used on blender objects in the game engine - * (where they get converted into C++ classes - CValue and subclasses) - */ - -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -#include <string.h> -#include <ctype.h> - -#include "MEM_guardedalloc.h" - -#include "DNA_property_types.h" -#include "DNA_object_types.h" - -#include "BLI_blenlib.h" - -#include "BKE_property.h" - -void BKE_bproperty_free(bProperty *prop) -{ - - if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin); - MEM_freeN(prop); - -} - -void BKE_bproperty_free_list(ListBase *lb) -{ - bProperty *prop; - - while ((prop = BLI_pophead(lb))) { - BKE_bproperty_free(prop); - } -} - -bProperty *BKE_bproperty_copy(const bProperty *prop) -{ - bProperty *propn; - - propn = MEM_dupallocN(prop); - if (prop->poin && prop->poin != &prop->data) { - propn->poin = MEM_dupallocN(prop->poin); - } - else { - propn->poin = &propn->data; - } - - return propn; -} - -void BKE_bproperty_copy_list(ListBase *lbn, const ListBase *lbo) -{ - bProperty *prop, *propn; - BKE_bproperty_free_list(lbn); /* in case we are copying to an object with props */ - prop = lbo->first; - while (prop) { - propn = BKE_bproperty_copy(prop); - BLI_addtail(lbn, propn); - prop = prop->next; - } - - -} - -void BKE_bproperty_init(bProperty *prop) -{ - /* also use when property changes type */ - - if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin); - prop->poin = NULL; - - prop->data = 0; - - switch (prop->type) { - case GPROP_BOOL: - case GPROP_INT: - case GPROP_FLOAT: - case GPROP_TIME: - prop->poin = &prop->data; - break; - case GPROP_STRING: - prop->poin = MEM_callocN(MAX_PROPSTRING, "property string"); - break; - } -} - - -bProperty *BKE_bproperty_new(int type) -{ - bProperty *prop; - - prop = MEM_callocN(sizeof(bProperty), "property"); - prop->type = type; - - BKE_bproperty_init(prop); - - strcpy(prop->name, "prop"); - - return prop; -} - - -bProperty *BKE_bproperty_object_get(Object *ob, const char *name) -{ - return BLI_findstring(&ob->prop, name, offsetof(bProperty, name)); -} - -void BKE_bproperty_object_set(Object *ob, bProperty *propc) -{ - bProperty *prop; - prop = BKE_bproperty_object_get(ob, propc->name); - if (prop) { - BLI_remlink(&ob->prop, prop); - BKE_bproperty_free(prop); - } - BLI_addtail(&ob->prop, BKE_bproperty_copy(propc)); -} - -/* negative: prop is smaller - * positive: prop is larger - */ -#if 0 /* UNUSED */ -int BKE_bproperty_cmp(bProperty *prop, const char *str) -{ -// extern int Gdfra; /* sector.c */ - float fvalue, ftest; - - switch (prop->type) { - case GPROP_BOOL: - if (BLI_strcasecmp(str, "true") == 0) { - if (prop->data == 1) return 0; - else return 1; - } - else if (BLI_strcasecmp(str, "false") == 0) { - if (prop->data == 0) return 0; - else return 1; - } - /* no break, do GPROP_int too! */ - - case GPROP_INT: - return prop->data - atoi(str); - - case GPROP_FLOAT: - case GPROP_TIME: - /* WARNING: untested for GPROP_TIME - * function isn't used currently */ - fvalue = *((float *)&prop->data); - ftest = (float)atof(str); - if (fvalue > ftest) return 1; - else if (fvalue < ftest) return -1; - return 0; - - case GPROP_STRING: - return strcmp(prop->poin, str); - } - - return 0; -} -#endif - -void BKE_bproperty_set(bProperty *prop, const char *str) -{ -// extern int Gdfra; /* sector.c */ - - switch (prop->type) { - case GPROP_BOOL: - if (BLI_strcasecmp(str, "true") == 0) prop->data = 1; - else if (BLI_strcasecmp(str, "false") == 0) prop->data = 0; - else prop->data = (atoi(str) != 0); - break; - case GPROP_INT: - prop->data = atoi(str); - break; - case GPROP_FLOAT: - case GPROP_TIME: - *((float *)&prop->data) = (float)atof(str); - break; - case GPROP_STRING: - strcpy(prop->poin, str); /* TODO - check size? */ - break; - } - -} - -void BKE_bproperty_add(bProperty *prop, const char *str) -{ -// extern int Gdfra; /* sector.c */ - - switch (prop->type) { - case GPROP_BOOL: - case GPROP_INT: - prop->data += atoi(str); - break; - case GPROP_FLOAT: - case GPROP_TIME: - *((float *)&prop->data) += (float)atof(str); - break; - case GPROP_STRING: - /* strcpy(prop->poin, str); */ - break; - } -} - -/* reads value of property, sets it in chars in str */ -void BKE_bproperty_set_valstr(bProperty *prop, char str[MAX_PROPSTRING]) -{ -// extern int Gdfra; /* sector.c */ - - if (str == NULL) return; - - switch (prop->type) { - case GPROP_BOOL: - case GPROP_INT: - sprintf(str, "%d", prop->data); - break; - case GPROP_FLOAT: - case GPROP_TIME: - sprintf(str, "%f", *((float *)&prop->data)); - break; - case GPROP_STRING: - BLI_strncpy(str, prop->poin, MAX_PROPSTRING); - break; - } -} - -#if 0 /* UNUSED */ -void cp_property(bProperty *prop1, bProperty *prop2) -{ - char str[128]; - - BKE_bproperty_set_valstr(prop2, str); - - BKE_bproperty_set(prop1, str); -} -#endif diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index ab8f9dcb2e4..fdeba7186e8 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1024,8 +1024,8 @@ RigidBodyOb *BKE_rigidbody_create_object(Scene *scene, Object *ob, short type) rbo->lin_sleep_thresh = 0.4f; /* 0.4 is half of Bullet default */ rbo->ang_sleep_thresh = 0.5f; /* 0.5 is half of Bullet default */ - rbo->lin_damping = 0.04f; /* 0.04 is game engine default */ - rbo->ang_damping = 0.1f; /* 0.1 is game engine default */ + rbo->lin_damping = 0.04f; + rbo->ang_damping = 0.1f; rbo->col_groups = 1; diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c deleted file mode 100644 index fb81ed4d47f..00000000000 --- a/source/blender/blenkernel/intern/sca.c +++ /dev/null @@ -1,1179 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * these all are linked to objects (listbase) - * all data is 'direct data', not Blender lib data. - */ - -/** \file blender/blenkernel/intern/sca.c - * \ingroup bke - */ - - -#include <stdio.h> -#include <string.h> -#include <float.h> - -#include "MEM_guardedalloc.h" - -#include "DNA_controller_types.h" -#include "DNA_sensor_types.h" -#include "DNA_actuator_types.h" -#include "DNA_object_types.h" - -#include "BLI_blenlib.h" -#include "BLI_ghash.h" -#include "BLI_math.h" - -#include "BKE_global.h" -#include "BKE_main.h" -#include "BKE_library.h" -#include "BKE_library_query.h" -#include "BKE_sca.h" - -/* ******************* SENSORS ************************ */ - -void free_sensor(bSensor *sens) -{ - if (sens->links) MEM_freeN(sens->links); - if (sens->data) MEM_freeN(sens->data); - MEM_freeN(sens); - -} - -void free_sensors(ListBase *lb) -{ - bSensor *sens; - - while ((sens = BLI_pophead(lb))) { - free_sensor(sens); - } -} - -bSensor *copy_sensor(bSensor *sens, const int UNUSED(flag)) -{ - bSensor *sensn; - - sensn= MEM_dupallocN(sens); - sensn->flag |= SENS_NEW; - if (sens->data) { - sensn->data= MEM_dupallocN(sens->data); - } - - if (sens->links) sensn->links= MEM_dupallocN(sens->links); - - return sensn; -} - -void copy_sensors(ListBase *lbn, const ListBase *lbo, const int flag) -{ - bSensor *sens, *sensn; - - lbn->first= lbn->last= NULL; - sens= lbo->first; - while (sens) { - sensn= copy_sensor(sens, flag); - BLI_addtail(lbn, sensn); - sens= sens->next; - } -} - -void init_sensor(bSensor *sens) -{ - /* also use when sensor changes type */ - bNearSensor *ns; - bMouseSensor *ms; - bJoystickSensor *js; - bRaySensor *rs; - - if (sens->data) MEM_freeN(sens->data); - sens->data= NULL; - sens->pulse = 0; - - switch (sens->type) { - case SENS_ALWAYS: - sens->pulse = 0; - break; - case SENS_NEAR: - ns=sens->data= MEM_callocN(sizeof(bNearSensor), "nearsens"); - ns->dist= 1.0; - ns->resetdist= 2.0; - break; - case SENS_KEYBOARD: - sens->data= MEM_callocN(sizeof(bKeyboardSensor), "keysens"); - break; - case SENS_PROPERTY: - sens->data= MEM_callocN(sizeof(bPropertySensor), "propsens"); - break; - case SENS_ARMATURE: - sens->data= MEM_callocN(sizeof(bArmatureSensor), "armsens"); - break; - case SENS_ACTUATOR: - sens->data= MEM_callocN(sizeof(bActuatorSensor), "actsens"); - break; - case SENS_DELAY: - sens->data= MEM_callocN(sizeof(bDelaySensor), "delaysens"); - break; - case SENS_MOUSE: - ms=sens->data= MEM_callocN(sizeof(bMouseSensor), "mousesens"); - ms->type= 1; // LEFTMOUSE workaround because Mouse Sensor types enum starts in 1 - break; - case SENS_COLLISION: - sens->data= MEM_callocN(sizeof(bCollisionSensor), "colsens"); - break; - case SENS_RADAR: - sens->data= MEM_callocN(sizeof(bRadarSensor), "radarsens"); - break; - case SENS_RANDOM: - sens->data= MEM_callocN(sizeof(bRandomSensor), "randomsens"); - break; - case SENS_RAY: - sens->data= MEM_callocN(sizeof(bRaySensor), "raysens"); - rs = sens->data; - rs->range = 0.01f; - break; - case SENS_MESSAGE: - sens->data= MEM_callocN(sizeof(bMessageSensor), "messagesens"); - break; - case SENS_JOYSTICK: - sens->data= MEM_callocN(sizeof(bJoystickSensor), "joysticksens"); - js= sens->data; - js->hatf = SENS_JOY_HAT_UP; - js->axis = 1; - js->hat = 1; - break; - default: - ; /* this is very severe... I cannot make any memory for this */ - /* logic brick... */ - } -} - -bSensor *new_sensor(int type) -{ - bSensor *sens; - - sens= MEM_callocN(sizeof(bSensor), "Sensor"); - sens->type= type; - sens->flag= SENS_SHOW; - - init_sensor(sens); - - strcpy(sens->name, "sensor"); -// XXX make_unique_prop_names(sens->name); - - return sens; -} - -/* ******************* CONTROLLERS ************************ */ - -void unlink_controller(bController *cont) -{ - bSensor *sens; - Object *ob; - - /* check for controller pointers in sensors */ - ob= G.main->object.first; - while (ob) { - sens= ob->sensors.first; - while (sens) { - unlink_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks); - sens= sens->next; - } - ob= ob->id.next; - } -} - -void unlink_controllers(ListBase *lb) -{ - bController *cont; - - for (cont= lb->first; cont; cont= cont->next) - unlink_controller(cont); -} - -void free_controller(bController *cont) -{ - if (cont->links) MEM_freeN(cont->links); - - /* the controller itself */ - if (cont->data) MEM_freeN(cont->data); - MEM_freeN(cont); - -} - -void free_controllers(ListBase *lb) -{ - bController *cont; - - while ((cont = BLI_pophead(lb))) { - if (cont->slinks) - MEM_freeN(cont->slinks); - free_controller(cont); - } -} - -bController *copy_controller(bController *cont, const int UNUSED(flag)) -{ - bController *contn; - - cont->mynew=contn= MEM_dupallocN(cont); - contn->flag |= CONT_NEW; - if (cont->data) { - contn->data= MEM_dupallocN(cont->data); - } - - if (cont->links) contn->links= MEM_dupallocN(cont->links); - contn->slinks= NULL; - contn->totslinks= 0; - - return contn; -} - -void copy_controllers(ListBase *lbn, const ListBase *lbo, const int flag) -{ - bController *cont, *contn; - - lbn->first= lbn->last= NULL; - cont= lbo->first; - while (cont) { - contn= copy_controller(cont, flag); - BLI_addtail(lbn, contn); - cont= cont->next; - } -} - -void init_controller(bController *cont) -{ - /* also use when controller changes type, leave actuators... */ - - if (cont->data) MEM_freeN(cont->data); - cont->data= NULL; - - switch (cont->type) { - case CONT_EXPRESSION: - cont->data= MEM_callocN(sizeof(bExpressionCont), "expcont"); - break; - case CONT_PYTHON: - cont->data= MEM_callocN(sizeof(bPythonCont), "pycont"); - break; - } -} - -bController *new_controller(int type) -{ - bController *cont; - - cont= MEM_callocN(sizeof(bController), "Controller"); - cont->type= type; - cont->flag= CONT_SHOW; - - init_controller(cont); - - strcpy(cont->name, "cont"); -// XXX make_unique_prop_names(cont->name); - - return cont; -} - -/* ******************* ACTUATORS ************************ */ - -void unlink_actuator(bActuator *act) -{ - bController *cont; - Object *ob; - - /* check for actuator pointers in controllers */ - ob= G.main->object.first; - while (ob) { - cont= ob->controllers.first; - while (cont) { - unlink_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks); - cont= cont->next; - } - ob= ob->id.next; - } -} - -void unlink_actuators(ListBase *lb) -{ - bActuator *act; - - for (act= lb->first; act; act= act->next) - unlink_actuator(act); -} - -void free_actuator(bActuator *act) -{ - if (act->data) { - switch (act->type) { - case ACT_ACTION: - case ACT_SHAPEACTION: - { - bActionActuator *aa = (bActionActuator *)act->data; - if (aa->act) - id_us_min((ID *)aa->act); - break; - } - case ACT_SOUND: - { - bSoundActuator *sa = (bSoundActuator *) act->data; - if (sa->sound) - id_us_min((ID *)sa->sound); - break; - } - } - - MEM_freeN(act->data); - } - MEM_freeN(act); -} - -void free_actuators(ListBase *lb) -{ - bActuator *act; - - while ((act = BLI_pophead(lb))) { - free_actuator(act); - } -} - -bActuator *copy_actuator(bActuator *act, const int flag) -{ - bActuator *actn; - - act->mynew=actn= MEM_dupallocN(act); - actn->flag |= ACT_NEW; - if (act->data) { - actn->data= MEM_dupallocN(act->data); - } - - switch (act->type) { - case ACT_ACTION: - case ACT_SHAPEACTION: - { - bActionActuator *aa = (bActionActuator *)act->data; - if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) { - id_us_plus((ID *)aa->act); - } - break; - } - case ACT_SOUND: - { - bSoundActuator *sa = (bSoundActuator *)act->data; - if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) { - id_us_plus((ID *)sa->sound); - } - break; - } - } - return actn; -} - -void copy_actuators(ListBase *lbn, const ListBase *lbo, const int flag) -{ - bActuator *act, *actn; - - lbn->first= lbn->last= NULL; - act= lbo->first; - while (act) { - actn= copy_actuator(act, flag); - BLI_addtail(lbn, actn); - act= act->next; - } -} - -void init_actuator(bActuator *act) -{ - /* also use when actuator changes type */ - bCameraActuator *ca; - bObjectActuator *oa; - bRandomActuator *ra; - bSoundActuator *sa; - bSteeringActuator *sta; - bArmatureActuator *arma; - bMouseActuator *ma; - bEditObjectActuator *eoa; - - if (act->data) MEM_freeN(act->data); - act->data= NULL; - - switch (act->type) { - case ACT_ACTION: - case ACT_SHAPEACTION: - act->data= MEM_callocN(sizeof(bActionActuator), "actionact"); - break; - case ACT_SOUND: - sa = act->data= MEM_callocN(sizeof(bSoundActuator), "soundact"); - sa->volume = 1.0f; - sa->sound3D.rolloff_factor = 1.0f; - sa->sound3D.reference_distance = 1.0f; - sa->sound3D.max_gain = 1.0f; - sa->sound3D.cone_inner_angle = DEG2RADF(360.0f); - sa->sound3D.cone_outer_angle = DEG2RADF(360.0f); - sa->sound3D.max_distance = FLT_MAX; - break; - case ACT_OBJECT: - act->data= MEM_callocN(sizeof(bObjectActuator), "objectact"); - oa= act->data; - oa->flag= 15; - break; - case ACT_PROPERTY: - act->data= MEM_callocN(sizeof(bPropertyActuator), "propact"); - break; - case ACT_CAMERA: - act->data= MEM_callocN(sizeof(bCameraActuator), "camact"); - ca = act->data; - ca->axis = OB_POSX; - ca->damping = 1.0/32.0; - break; - case ACT_EDIT_OBJECT: - act->data= MEM_callocN(sizeof(bEditObjectActuator), "editobact"); - eoa = act->data; - eoa->upflag= ACT_TRACK_UP_Z; - eoa->trackflag= ACT_TRACK_TRAXIS_Y; - break; - case ACT_CONSTRAINT: - act->data= MEM_callocN(sizeof(bConstraintActuator), "cons act"); - break; - case ACT_SCENE: - act->data= MEM_callocN(sizeof(bSceneActuator), "scene act"); - break; - case ACT_GROUP: - act->data= MEM_callocN(sizeof(bGroupActuator), "group act"); - break; - case ACT_RANDOM: - act->data= MEM_callocN(sizeof(bRandomActuator), "random act"); - ra=act->data; - ra->float_arg_1 = 0.1f; - break; - case ACT_MESSAGE: - act->data= MEM_callocN(sizeof(bMessageActuator), "message act"); - break; - case ACT_GAME: - act->data= MEM_callocN(sizeof(bGameActuator), "game act"); - break; - case ACT_VISIBILITY: - act->data= MEM_callocN(sizeof(bVisibilityActuator), "visibility act"); - break; - case ACT_2DFILTER: - act->data = MEM_callocN(sizeof( bTwoDFilterActuator ), "2d filter act"); - break; - case ACT_PARENT: - act->data = MEM_callocN(sizeof( bParentActuator ), "parent act"); - break; - case ACT_STATE: - act->data = MEM_callocN(sizeof( bStateActuator ), "state act"); - break; - case ACT_ARMATURE: - act->data = MEM_callocN(sizeof( bArmatureActuator ), "armature act"); - arma = act->data; - arma->influence = 1.f; - break; - case ACT_STEERING: - act->data = MEM_callocN(sizeof( bSteeringActuator), "steering act"); - sta = act->data; - sta->acceleration = 3.f; - sta->turnspeed = 120.f; - sta->dist = 1.f; - sta->velocity= 3.f; - sta->flag = ACT_STEERING_AUTOMATICFACING | ACT_STEERING_LOCKZVEL; - sta->facingaxis = 1; - break; - case ACT_MOUSE: - ma = act->data = MEM_callocN(sizeof( bMouseActuator ), "mouse act"); - ma->flag = ACT_MOUSE_VISIBLE|ACT_MOUSE_USE_AXIS_X|ACT_MOUSE_USE_AXIS_Y|ACT_MOUSE_RESET_X|ACT_MOUSE_RESET_Y|ACT_MOUSE_LOCAL_Y; - ma->sensitivity[0] = ma->sensitivity[1] = 2.f; - ma->object_axis[0] = ACT_MOUSE_OBJECT_AXIS_Z; - ma->object_axis[1] = ACT_MOUSE_OBJECT_AXIS_X; - ma->limit_y[0] = DEG2RADF(-90.0f); - ma->limit_y[1] = DEG2RADF(90.0f); - break; - default: - ; /* this is very severe... I cannot make any memory for this */ - /* logic brick... */ - } -} - -bActuator *new_actuator(int type) -{ - bActuator *act; - - act= MEM_callocN(sizeof(bActuator), "Actuator"); - act->type= type; - act->flag= ACT_SHOW; - - init_actuator(act); - - strcpy(act->name, "act"); -// XXX make_unique_prop_names(act->name); - - return act; -} - -/* ******************** GENERAL ******************* */ -void clear_sca_new_poins_ob(Object *ob) -{ - bSensor *sens; - bController *cont; - bActuator *act; - - sens= ob->sensors.first; - while (sens) { - sens->flag &= ~SENS_NEW; - sens= sens->next; - } - cont= ob->controllers.first; - while (cont) { - cont->mynew= NULL; - cont->flag &= ~CONT_NEW; - cont= cont->next; - } - act= ob->actuators.first; - while (act) { - act->mynew= NULL; - act->flag &= ~ACT_NEW; - act= act->next; - } -} - -void clear_sca_new_poins(void) -{ - Object *ob; - - ob= G.main->object.first; - while (ob) { - clear_sca_new_poins_ob(ob); - ob= ob->id.next; - } -} - -void set_sca_new_poins_ob(Object *ob) -{ - bSensor *sens; - bController *cont; - bActuator *act; - int a; - - sens= ob->sensors.first; - while (sens) { - if (sens->flag & SENS_NEW) { - for (a=0; a<sens->totlinks; a++) { - if (sens->links[a] && sens->links[a]->mynew) - sens->links[a] = sens->links[a]->mynew; - } - } - sens= sens->next; - } - - cont= ob->controllers.first; - while (cont) { - if (cont->flag & CONT_NEW) { - for (a=0; a<cont->totlinks; a++) { - if ( cont->links[a] && cont->links[a]->mynew) - cont->links[a] = cont->links[a]->mynew; - } - } - cont= cont->next; - } - - - act= ob->actuators.first; - while (act) { - if (act->flag & ACT_NEW) { - if (act->type==ACT_EDIT_OBJECT) { - bEditObjectActuator *eoa= act->data; - ID_NEW_REMAP(eoa->ob); - } - else if (act->type==ACT_SCENE) { - bSceneActuator *sca= act->data; - ID_NEW_REMAP(sca->camera); - } - else if (act->type==ACT_CAMERA) { - bCameraActuator *ca= act->data; - ID_NEW_REMAP(ca->ob); - } - else if (act->type==ACT_OBJECT) { - bObjectActuator *oa= act->data; - ID_NEW_REMAP(oa->reference); - } - else if (act->type==ACT_MESSAGE) { - bMessageActuator *ma= act->data; - ID_NEW_REMAP(ma->toObject); - } - else if (act->type==ACT_PARENT) { - bParentActuator *para = act->data; - ID_NEW_REMAP(para->ob); - } - else if (act->type==ACT_ARMATURE) { - bArmatureActuator *aa = act->data; - ID_NEW_REMAP(aa->target); - ID_NEW_REMAP(aa->subtarget); - } - else if (act->type==ACT_PROPERTY) { - bPropertyActuator *pa= act->data; - ID_NEW_REMAP(pa->ob); - } - else if (act->type==ACT_STEERING) { - bSteeringActuator *sta = act->data; - ID_NEW_REMAP(sta->navmesh); - ID_NEW_REMAP(sta->target); - } - } - act= act->next; - } -} - - -void set_sca_new_poins(void) -{ - Object *ob; - - ob= G.main->object.first; - while (ob) { - set_sca_new_poins_ob(ob); - ob= ob->id.next; - } -} - -/** - * Try to remap logic links to new object... Very, *very* weak. - */ -/* XXX Logick bricks... I don't have words to say what I think about this behavior. - * They have silent hidden ugly inter-objects dependencies (a sensor can link into any other - * object's controllers, and same between controllers and actuators, without *any* explicit reference - * to data-block involved). - * This is bad, bad, bad!!! - * ...and forces us to add yet another very ugly hack to get remapping with logic bricks working. */ -void BKE_sca_logic_links_remap(Main *bmain, Object *ob_old, Object *ob_new) -{ - if (ob_new == NULL || (ob_old->controllers.first == NULL && ob_old->actuators.first == NULL)) { - /* Nothing to do here... */ - return; - } - - GHash *controllers_map = ob_old->controllers.first ? - BLI_ghash_ptr_new_ex(__func__, BLI_listbase_count(&ob_old->controllers)) : NULL; - GHash *actuators_map = ob_old->actuators.first ? - BLI_ghash_ptr_new_ex(__func__, BLI_listbase_count(&ob_old->actuators)) : NULL; - - /* We try to remap old controllers/actuators to new ones - in a very basic way. */ - for (bController *cont_old = ob_old->controllers.first, *cont_new = ob_new->controllers.first; - cont_old; - cont_old = cont_old->next) - { - bController *cont_new2 = cont_new; - - if (cont_old->mynew != NULL) { - cont_new2 = cont_old->mynew; - if (!(cont_new2 == cont_new || BLI_findindex(&ob_new->controllers, cont_new2) >= 0)) { - cont_new2 = NULL; - } - } - else if (cont_new && cont_old->type != cont_new->type) { - cont_new2 = NULL; - } - - BLI_ghash_insert(controllers_map, cont_old, cont_new2); - - if (cont_new) { - cont_new = cont_new->next; - } - } - - for (bActuator *act_old = ob_old->actuators.first, *act_new = ob_new->actuators.first; - act_old; - act_old = act_old->next) - { - bActuator *act_new2 = act_new; - - if (act_old->mynew != NULL) { - act_new2 = act_old->mynew; - if (!(act_new2 == act_new || BLI_findindex(&ob_new->actuators, act_new2) >= 0)) { - act_new2 = NULL; - } - } - else if (act_new && act_old->type != act_new->type) { - act_new2 = NULL; - } - - BLI_ghash_insert(actuators_map, act_old, act_new2); - - if (act_new) { - act_new = act_new->next; - } - } - - for (Object *ob = bmain->object.first; ob; ob = ob->id.next) { - if (controllers_map != NULL) { - for (bSensor *sens = ob->sensors.first; sens; sens = sens->next) { - for (int a = 0; a < sens->totlinks; a++) { - if (sens->links[a]) { - bController *old_link = sens->links[a]; - bController **new_link_p = (bController **)BLI_ghash_lookup_p(controllers_map, old_link); - - if (new_link_p == NULL) { - /* old_link is *not* in map's keys (i.e. not to any ob_old->controllers), - * which means we ignore it totally here. */ - } - else if (*new_link_p == NULL) { - unlink_logicbricks((void **)&old_link, (void ***)&(sens->links), &sens->totlinks); - a--; - } - else { - sens->links[a] = *new_link_p; - } - } - } - } - } - - if (actuators_map != NULL) { - for (bController *cont = ob->controllers.first; cont; cont = cont->next) { - for (int a = 0; a < cont->totlinks; a++) { - if (cont->links[a]) { - bActuator *old_link = cont->links[a]; - bActuator **new_link_p = (bActuator **)BLI_ghash_lookup_p(actuators_map, old_link); - - if (new_link_p == NULL) { - /* old_link is *not* in map's keys (i.e. not to any ob_old->actuators), - * which means we ignore it totally here. */ - } - else if (*new_link_p == NULL) { - unlink_logicbricks((void **)&old_link, (void ***)&(cont->links), &cont->totlinks); - a--; - } - else { - cont->links[a] = *new_link_p; - } - } - } - } - } - } - - if (controllers_map) { - BLI_ghash_free(controllers_map, NULL, NULL); - } - if (actuators_map) { - BLI_ghash_free(actuators_map, NULL, NULL); - } -} - -/** - * Handle the copying of logic data into a new object, including internal logic links update. - * External links (links between logic bricks of different objects) must be handled separately. - */ -void BKE_sca_logic_copy(Object *ob_new, const Object *ob, const int flag) -{ - copy_sensors(&ob_new->sensors, &ob->sensors, flag); - copy_controllers(&ob_new->controllers, &ob->controllers, flag); - copy_actuators(&ob_new->actuators, &ob->actuators, flag); - - for (bSensor *sens = ob_new->sensors.first; sens; sens = sens->next) { - if (sens->flag & SENS_NEW) { - for (int a = 0; a < sens->totlinks; a++) { - if (sens->links[a] && sens->links[a]->mynew) { - sens->links[a] = sens->links[a]->mynew; - } - } - } - } - - for (bController *cont = ob_new->controllers.first; cont; cont = cont->next) { - if (cont->flag & CONT_NEW) { - for (int a = 0; a < cont->totlinks; a++) { - if (cont->links[a] && cont->links[a]->mynew) { - cont->links[a] = cont->links[a]->mynew; - } - } - } - } -} - -/* ******************** INTERFACE ******************* */ -void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up) -{ - bSensor *sens, *tmp; - - int val; - val = move_up ? 1 : 2; - - /* make sure this sensor belongs to this object */ - sens= ob->sensors.first; - while (sens) { - if (sens == sens_to_move) break; - sens= sens->next; - } - if (!sens) return; - - /* move up */ - if (val == 1 && sens->prev) { - for (tmp=sens->prev; tmp; tmp=tmp->prev) { - if (tmp->flag & SENS_VISIBLE) - break; - } - if (tmp) { - BLI_remlink(&ob->sensors, sens); - BLI_insertlinkbefore(&ob->sensors, tmp, sens); - } - } - /* move down */ - else if (val == 2 && sens->next) { - for (tmp=sens->next; tmp; tmp=tmp->next) { - if (tmp->flag & SENS_VISIBLE) - break; - } - if (tmp) { - BLI_remlink(&ob->sensors, sens); - BLI_insertlinkafter(&ob->sensors, tmp, sens); - } - } -} - -void sca_move_controller(bController *cont_to_move, Object *ob, int move_up) -{ - bController *cont, *tmp; - - int val; - val = move_up ? 1 : 2; - - /* make sure this controller belongs to this object */ - cont= ob->controllers.first; - while (cont) { - if (cont == cont_to_move) break; - cont= cont->next; - } - if (!cont) return; - - /* move up */ - if (val == 1 && cont->prev) { - /* locate the controller that has the same state mask but is earlier in the list */ - tmp = cont->prev; - while (tmp) { - if (tmp->state_mask & cont->state_mask) - break; - tmp = tmp->prev; - } - if (tmp) { - BLI_remlink(&ob->controllers, cont); - BLI_insertlinkbefore(&ob->controllers, tmp, cont); - } - } - - /* move down */ - else if (val == 2 && cont->next) { - tmp = cont->next; - while (tmp) { - if (tmp->state_mask & cont->state_mask) - break; - tmp = tmp->next; - } - BLI_remlink(&ob->controllers, cont); - BLI_insertlinkafter(&ob->controllers, tmp, cont); - } -} - -void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up) -{ - bActuator *act, *tmp; - int val; - - val = move_up ? 1 : 2; - - /* make sure this actuator belongs to this object */ - act= ob->actuators.first; - while (act) { - if (act == act_to_move) break; - act= act->next; - } - if (!act) return; - - /* move up */ - if (val == 1 && act->prev) { - /* locate the first visible actuators before this one */ - for (tmp = act->prev; tmp; tmp=tmp->prev) { - if (tmp->flag & ACT_VISIBLE) - break; - } - if (tmp) { - BLI_remlink(&ob->actuators, act); - BLI_insertlinkbefore(&ob->actuators, tmp, act); - } - } - /* move down */ - else if (val == 2 && act->next) { - /* locate the first visible actuators after this one */ - for (tmp=act->next; tmp; tmp=tmp->next) { - if (tmp->flag & ACT_VISIBLE) - break; - } - if (tmp) { - BLI_remlink(&ob->actuators, act); - BLI_insertlinkafter(&ob->actuators, tmp, act); - } - } -} - -void link_logicbricks(void **poin, void ***ppoin, short *tot, short size) -{ - void **old_links= NULL; - - int ibrick; - - /* check if the bricks are already linked */ - for (ibrick=0; ibrick < *tot; ibrick++) { - if ((*ppoin)[ibrick] == *poin) - return; - } - - if (*ppoin) { - old_links= *ppoin; - - (*tot) ++; - *ppoin = MEM_callocN((*tot)*size, "new link"); - - for (ibrick=0; ibrick < *(tot) - 1; ibrick++) { - (*ppoin)[ibrick] = old_links[ibrick]; - } - (*ppoin)[ibrick] = *poin; - - if (old_links) MEM_freeN(old_links); - } - else { - (*tot) = 1; - *ppoin = MEM_callocN((*tot)*size, "new link"); - (*ppoin)[0] = *poin; - } -} - -void unlink_logicbricks(void **poin, void ***ppoin, short *tot) -{ - int ibrick, removed; - - removed= 0; - for (ibrick=0; ibrick < *tot; ibrick++) { - if (removed) (*ppoin)[ibrick - removed] = (*ppoin)[ibrick]; - else if ((*ppoin)[ibrick] == *poin) removed = 1; - } - - if (removed) { - (*tot) --; - - if (*tot == 0) { - MEM_freeN(*ppoin); - (*ppoin)= NULL; - } - return; - } -} - -void BKE_sca_sensors_id_loop(ListBase *senslist, SCASensorIDFunc func, void *userdata) -{ - bSensor *sensor; - - for (sensor = senslist->first; sensor; sensor = sensor->next) { - func(sensor, (ID **)&sensor->ob, userdata, IDWALK_CB_NOP); - - switch (sensor->type) { - case SENS_TOUCH: /* DEPRECATED */ - { - bTouchSensor *ts = sensor->data; - func(sensor, (ID **)&ts->ma, userdata, IDWALK_CB_NOP); - break; - } - case SENS_MESSAGE: - { - bMessageSensor *ms = sensor->data; - func(sensor, (ID **)&ms->fromObject, userdata, IDWALK_CB_NOP); - break; - } - case SENS_ALWAYS: - case SENS_NEAR: - case SENS_KEYBOARD: - case SENS_PROPERTY: - case SENS_MOUSE: - case SENS_COLLISION: - case SENS_RADAR: - case SENS_RANDOM: - case SENS_RAY: - case SENS_JOYSTICK: - case SENS_ACTUATOR: - case SENS_DELAY: - case SENS_ARMATURE: - default: - break; - } - } -} - -void BKE_sca_controllers_id_loop(ListBase *contlist, SCAControllerIDFunc func, void *userdata) -{ - bController *controller; - - for (controller = contlist->first; controller; controller = controller->next) { - switch (controller->type) { - case CONT_PYTHON: - { - bPythonCont *pc = controller->data; - func(controller, (ID **)&pc->text, userdata, IDWALK_CB_NOP); - break; - } - case CONT_LOGIC_AND: - case CONT_LOGIC_OR: - case CONT_EXPRESSION: - case CONT_LOGIC_NAND: - case CONT_LOGIC_NOR: - case CONT_LOGIC_XOR: - case CONT_LOGIC_XNOR: - default: - break; - } - } -} - -void BKE_sca_actuators_id_loop(ListBase *actlist, SCAActuatorIDFunc func, void *userdata) -{ - bActuator *actuator; - - for (actuator = actlist->first; actuator; actuator = actuator->next) { - func(actuator, (ID **)&actuator->ob, userdata, IDWALK_CB_NOP); - - switch (actuator->type) { - case ACT_ADD_OBJECT: /* DEPRECATED */ - { - bAddObjectActuator *aoa = actuator->data; - func(actuator, (ID **)&aoa->ob, userdata, IDWALK_CB_NOP); - break; - } - case ACT_ACTION: - { - bActionActuator *aa = actuator->data; - func(actuator, (ID **)&aa->act, userdata, IDWALK_CB_NOP); - break; - } - case ACT_SOUND: - { - bSoundActuator *sa = actuator->data; - func(actuator, (ID **)&sa->sound, userdata, IDWALK_CB_NOP); - break; - } - case ACT_EDIT_OBJECT: - { - bEditObjectActuator *eoa = actuator->data; - func(actuator, (ID **)&eoa->ob, userdata, IDWALK_CB_NOP); - func(actuator, (ID **)&eoa->me, userdata, IDWALK_CB_NOP); - break; - } - case ACT_SCENE: - { - bSceneActuator *sa = actuator->data; - func(actuator, (ID **)&sa->scene, userdata, IDWALK_CB_NOP); - func(actuator, (ID **)&sa->camera, userdata, IDWALK_CB_NOP); - break; - } - case ACT_PROPERTY: - { - bPropertyActuator *pa = actuator->data; - func(actuator, (ID **)&pa->ob, userdata, IDWALK_CB_NOP); - break; - } - case ACT_OBJECT: - { - bObjectActuator *oa = actuator->data; - func(actuator, (ID **)&oa->reference, userdata, IDWALK_CB_NOP); - break; - } - case ACT_CAMERA: - { - bCameraActuator *ca = actuator->data; - func(actuator, (ID **)&ca->ob, userdata, IDWALK_CB_NOP); - break; - } - case ACT_MESSAGE: - { - bMessageActuator *ma = actuator->data; - func(actuator, (ID **)&ma->toObject, userdata, IDWALK_CB_NOP); - break; - } - case ACT_2DFILTER: - { - bTwoDFilterActuator *tdfa = actuator->data; - func(actuator, (ID **)&tdfa->text, userdata, IDWALK_CB_NOP); - break; - } - case ACT_PARENT: - { - bParentActuator *pa = actuator->data; - func(actuator, (ID **)&pa->ob, userdata, IDWALK_CB_NOP); - break; - } - case ACT_ARMATURE: - { - bArmatureActuator *aa = actuator->data; - func(actuator, (ID **)&aa->target, userdata, IDWALK_CB_NOP); - func(actuator, (ID **)&aa->subtarget, userdata, IDWALK_CB_NOP); - break; - } - case ACT_STEERING: - { - bSteeringActuator *sa = actuator->data; - func(actuator, (ID **)&sa->target, userdata, IDWALK_CB_NOP); - func(actuator, (ID **)&sa->navmesh, userdata, IDWALK_CB_NOP); - break; - } - /* Note: some types seems to be non-implemented? ACT_LAMP, ACT_MATERIAL... */ - case ACT_LAMP: - case ACT_MATERIAL: - case ACT_END_OBJECT: /* DEPRECATED */ - case ACT_CONSTRAINT: - case ACT_GROUP: - case ACT_RANDOM: - case ACT_GAME: - case ACT_VISIBILITY: - case ACT_SHAPEACTION: - case ACT_STATE: - case ACT_MOUSE: - default: - break; - } - } -} - -const char *sca_state_name_get(Object *ob, short bit) -{ - bController *cont; - unsigned int mask; - - mask = (1<<bit); - cont = ob->controllers.first; - while (cont) { - if (cont->state_mask & mask) { - return cont->name; - } - cont = cont->next; - } - return NULL; -} - diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index ee60a9b9f4d..e94a722ca28 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -112,7 +112,6 @@ #include "bmesh.h" const char *RE_engine_id_BLENDER_RENDER = "BLENDER_RENDER"; -const char *RE_engine_id_BLENDER_GAME = "BLENDER_GAME"; const char *RE_engine_id_BLENDER_CLAY = "BLENDER_CLAY"; const char *RE_engine_id_BLENDER_EEVEE = "BLENDER_EEVEE"; const char *RE_engine_id_BLENDER_WORKBENCH = "BLENDER_WORKBENCH"; @@ -351,7 +350,6 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type) sce_copy->r.views = rv; sce_copy->unit = sce->unit; sce_copy->physics_settings = sce->physics_settings; - sce_copy->gm = sce->gm; sce_copy->audio = sce->audio; if (sce->id.properties) @@ -767,59 +765,6 @@ void BKE_scene_init(Scene *sce) srv = sce->r.views.last; BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix)); - /* game data */ - sce->gm.stereoflag = STEREO_NOSTEREO; - sce->gm.stereomode = STEREO_ANAGLYPH; - sce->gm.eyeseparation = 0.10; - - sce->gm.dome.angle = 180; - sce->gm.dome.mode = DOME_FISHEYE; - sce->gm.dome.res = 4; - sce->gm.dome.resbuf = 1.0f; - sce->gm.dome.tilt = 0; - - sce->gm.xplay = 640; - sce->gm.yplay = 480; - sce->gm.freqplay = 60; - sce->gm.depth = 32; - - sce->gm.gravity = 9.8f; - sce->gm.physicsEngine = WOPHY_BULLET; - sce->gm.mode = 32; //XXX ugly harcoding, still not sure we should drop mode. 32 == 1 << 5 == use_occlusion_culling - sce->gm.occlusionRes = 128; - sce->gm.ticrate = 60; - sce->gm.maxlogicstep = 5; - sce->gm.physubstep = 1; - sce->gm.maxphystep = 5; - sce->gm.lineardeactthreshold = 0.8f; - sce->gm.angulardeactthreshold = 1.0f; - sce->gm.deactivationtime = 0.0f; - - sce->gm.flag = 0; - sce->gm.matmode = GAME_MAT_MULTITEX; - - sce->gm.obstacleSimulation = OBSTSIMULATION_NONE; - sce->gm.levelHeight = 2.f; - - sce->gm.recastData.cellsize = 0.3f; - sce->gm.recastData.cellheight = 0.2f; - sce->gm.recastData.agentmaxslope = M_PI_4; - sce->gm.recastData.agentmaxclimb = 0.9f; - sce->gm.recastData.agentheight = 2.0f; - sce->gm.recastData.agentradius = 0.6f; - sce->gm.recastData.edgemaxlen = 12.0f; - sce->gm.recastData.edgemaxerror = 1.3f; - sce->gm.recastData.regionminsize = 8.f; - sce->gm.recastData.regionmergesize = 20.f; - sce->gm.recastData.vertsperpoly = 6; - sce->gm.recastData.detailsampledist = 6.0f; - sce->gm.recastData.detailsamplemaxerror = 1.0f; - - sce->gm.lodflag = SCE_LOD_USE_HYST; - sce->gm.scehysteresis = 10; - - sce->gm.exitkey = 218; // Blender key code for ESC - BKE_sound_create_scene(sce); /* color management */ @@ -1605,11 +1550,6 @@ bool BKE_scene_uses_blender_internal(const Scene *scene) return BKE_viewrender_uses_blender_internal(&scene->view_render); } -bool BKE_scene_uses_blender_game(const Scene *scene) -{ - return BKE_viewrender_uses_blender_game(&scene->view_render); -} - bool BKE_scene_uses_blender_eevee(const Scene *scene) { return BKE_viewrender_uses_blender_eevee(&scene->view_render); @@ -1778,12 +1718,6 @@ bool BKE_viewrender_uses_blender_internal(const ViewRender *view_render) return STREQ(engine_id, RE_engine_id_BLENDER_RENDER); } -bool BKE_viewrender_uses_blender_game(const ViewRender *view_render) -{ - const char *engine_id = view_render->engine_id; - return STREQ(engine_id, RE_engine_id_BLENDER_GAME); -} - bool BKE_viewrender_uses_blender_eevee(const ViewRender *view_render) { const char *engine_id = view_render->engine_id; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index b1ff2724375..3892b2f0546 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -47,8 +47,6 @@ #include "BLI_fileops.h" #include "DNA_constraint_types.h" -#include "DNA_controller_types.h" -#include "DNA_actuator_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index be53d1f603b..adc7bf5af6b 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -49,8 +49,6 @@ typedef enum { BLI_CB_EVT_LOAD_POST, BLI_CB_EVT_SAVE_PRE, BLI_CB_EVT_SAVE_POST, - BLI_CB_EVT_GAME_PRE, - BLI_CB_EVT_GAME_POST, BLI_CB_EVT_VERSION_UPDATE, BLI_CB_EVT_TOT } eCbEvent; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f2f5dd2d27b..dad9d92225f 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -61,12 +61,10 @@ #include "DNA_anim_types.h" #include "DNA_armature_types.h" -#include "DNA_actuator_types.h" #include "DNA_brush_types.h" #include "DNA_camera_types.h" #include "DNA_cachefile_types.h" #include "DNA_cloth_types.h" -#include "DNA_controller_types.h" #include "DNA_constraint_types.h" #include "DNA_dynamicpaint_types.h" #include "DNA_effect_types.h" @@ -91,12 +89,10 @@ #include "DNA_packedFile_types.h" #include "DNA_particle_types.h" #include "DNA_lightprobe_types.h" -#include "DNA_property_types.h" #include "DNA_rigidbody_types.h" #include "DNA_text_types.h" #include "DNA_view3d_types.h" #include "DNA_screen_types.h" -#include "DNA_sensor_types.h" #include "DNA_sdna_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" @@ -152,7 +148,6 @@ #include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_report.h" -#include "BKE_sca.h" // for init_actuator #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_sequencer.h" @@ -4980,144 +4975,7 @@ static void lib_link_object(FileData *fd, Main *main) paf->group = newlibadr_us(fd, ob->id.lib, paf->group); } } - - for (bSensor *sens = ob->sensors.first; sens; sens = sens->next) { - for (a = 0; a < sens->totlinks; a++) - sens->links[a] = newglobadr(fd, sens->links[a]); - if (sens->type == SENS_MESSAGE) { - bMessageSensor *ms = sens->data; - ms->fromObject = - newlibadr(fd, ob->id.lib, ms->fromObject); - } - } - - for (bController *cont = ob->controllers.first; cont; cont = cont->next) { - for (a=0; a < cont->totlinks; a++) - cont->links[a] = newglobadr(fd, cont->links[a]); - - if (cont->type == CONT_PYTHON) { - bPythonCont *pc = cont->data; - pc->text = newlibadr(fd, ob->id.lib, pc->text); - } - cont->slinks = NULL; - cont->totslinks = 0; - } - - for (bActuator *act = ob->actuators.first; act; act = act->next) { - switch (act->type) { - case ACT_SOUND: - { - bSoundActuator *sa = act->data; - sa->sound = newlibadr_us(fd, ob->id.lib, sa->sound); - break; - } - case ACT_GAME: - /* bGameActuator *ga= act->data; */ - break; - case ACT_CAMERA: - { - bCameraActuator *ca = act->data; - ca->ob = newlibadr(fd, ob->id.lib, ca->ob); - break; - } - /* leave this one, it's obsolete but necessary to read for conversion */ - case ACT_ADD_OBJECT: - { - bAddObjectActuator *eoa = act->data; - if (eoa) - eoa->ob = newlibadr(fd, ob->id.lib, eoa->ob); - break; - } - case ACT_OBJECT: - { - bObjectActuator *oa = act->data; - if (oa == NULL) { - init_actuator(act); - } - else { - oa->reference = newlibadr(fd, ob->id.lib, oa->reference); - } - break; - } - case ACT_EDIT_OBJECT: - { - bEditObjectActuator *eoa = act->data; - if (eoa == NULL) { - init_actuator(act); - } - else { - eoa->ob = newlibadr(fd, ob->id.lib, eoa->ob); - eoa->me = newlibadr(fd, ob->id.lib, eoa->me); - } - break; - } - case ACT_SCENE: - { - bSceneActuator *sa = act->data; - sa->camera = newlibadr(fd, ob->id.lib, sa->camera); - sa->scene = newlibadr(fd, ob->id.lib, sa->scene); - break; - } - case ACT_ACTION: - { - bActionActuator *aa = act->data; - aa->act = newlibadr_us(fd, ob->id.lib, aa->act); - break; - } - case ACT_SHAPEACTION: - { - bActionActuator *aa = act->data; - aa->act = newlibadr_us(fd, ob->id.lib, aa->act); - break; - } - case ACT_PROPERTY: - { - bPropertyActuator *pa = act->data; - pa->ob = newlibadr(fd, ob->id.lib, pa->ob); - break; - } - case ACT_MESSAGE: - { - bMessageActuator *ma = act->data; - ma->toObject = newlibadr(fd, ob->id.lib, ma->toObject); - break; - } - case ACT_2DFILTER: - { - bTwoDFilterActuator *_2dfa = act->data; - _2dfa->text = newlibadr(fd, ob->id.lib, _2dfa->text); - break; - } - case ACT_PARENT: - { - bParentActuator *parenta = act->data; - parenta->ob = newlibadr(fd, ob->id.lib, parenta->ob); - break; - } - case ACT_STATE: - /* bStateActuator *statea = act->data; */ - break; - case ACT_ARMATURE: - { - bArmatureActuator *arma= act->data; - arma->target = newlibadr(fd, ob->id.lib, arma->target); - arma->subtarget = newlibadr(fd, ob->id.lib, arma->subtarget); - break; - } - case ACT_STEERING: - { - bSteeringActuator *steeringa = act->data; - steeringa->target = newlibadr(fd, ob->id.lib, steeringa->target); - steeringa->navmesh = newlibadr(fd, ob->id.lib, steeringa->navmesh); - break; - } - case ACT_MOUSE: - /* bMouseActuator *moa = act->data; */ - break; - } - } - { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); @@ -5542,10 +5400,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) static void direct_link_object(FileData *fd, Object *ob) { PartEff *paf; - bProperty *prop; - bSensor *sens; - bController *cont; - bActuator *act; /* weak weak... this was only meant as draw flag, now is used in give_base_to_objects too */ ob->flag &= ~OB_FROMGROUP; @@ -5667,7 +5521,6 @@ static void direct_link_object(FileData *fd, Object *ob) direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0); } - ob->bsoft = newdataadr(fd, ob->bsoft); ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */ ob->rigidbody_object = newdataadr(fd, ob->rigidbody_object); @@ -5686,44 +5539,9 @@ static void direct_link_object(FileData *fd, Object *ob) link_list(fd, &ob->particlesystem); direct_link_particlesystems(fd, &ob->particlesystem); - - link_list(fd, &ob->prop); - for (prop = ob->prop.first; prop; prop = prop->next) { - prop->poin = newdataadr(fd, prop->poin); - if (prop->poin == NULL) - prop->poin = &prop->data; - } - - link_list(fd, &ob->sensors); - for (sens = ob->sensors.first; sens; sens = sens->next) { - sens->data = newdataadr(fd, sens->data); - sens->links = newdataadr(fd, sens->links); - test_pointer_array(fd, (void **)&sens->links); - } direct_link_constraints(fd, &ob->constraints); - link_glob_list(fd, &ob->controllers); - if (ob->init_state) { - /* if a known first state is specified, set it so that the game will start ok */ - ob->state = ob->init_state; - } - else if (!ob->state) { - ob->state = 1; - } - for (cont = ob->controllers.first; cont; cont = cont->next) { - cont->data = newdataadr(fd, cont->data); - cont->links = newdataadr(fd, cont->links); - test_pointer_array(fd, (void **)&cont->links); - if (cont->state_mask == 0) - cont->state_mask = 1; - } - - link_glob_list(fd, &ob->actuators); - for (act = ob->actuators.first; act; act = act->next) { - act->data = newdataadr(fd, act->data); - } - link_list(fd, &ob->hooks); while (ob->hooks.first) { ObHook *hook = ob->hooks.first; @@ -6042,9 +5860,6 @@ static void lib_link_scene(FileData *fd, Main *main) fls->group = newlibadr_us(fd, sce->id.lib, fls->group); } } - /*Game Settings: Dome Warp Text*/ - sce->gm.dome.warptext = newlibadr(fd, sce->id.lib, sce->gm.dome.warptext); - /* Motion Tracking */ sce->clip = newlibadr_us(fd, sce->id.lib, sce->clip); @@ -6664,7 +6479,7 @@ static void direct_link_area(FileData *fd, ScrArea *area) area->type = NULL; /* spacetype callbacks */ area->region_active_win = -1; - /* if we do not have the spacetype registered (game player), we cannot + /* if we do not have the spacetype registered we cannot * free it, so don't allocate any new memory for such spacetypes. */ if (!BKE_spacetype_exists(area->spacetype)) { area->spacetype = SPACE_EMPTY; @@ -6692,7 +6507,7 @@ static void direct_link_area(FileData *fd, ScrArea *area) for (sl = area->spacedata.first; sl; sl = sl->next) { link_list(fd, &(sl->regionbase)); - /* if we do not have the spacetype registered (game player), we cannot + /* if we do not have the spacetype registered we cannot * free it, so don't allocate any new memory for such spacetypes. */ if (!BKE_spacetype_exists(sl->spacetype)) sl->spacetype = SPACE_EMPTY; @@ -6810,15 +6625,6 @@ static void direct_link_area(FileData *fd, ScrArea *area) SpaceTime *stime = (SpaceTime *)sl; BLI_listbase_clear(&stime->caches); } - else if (sl->spacetype == SPACE_LOGIC) { - SpaceLogic *slogic = (SpaceLogic *)sl; - - /* XXX: this is new stuff, which shouldn't be directly linking to gpd... */ - if (slogic->gpd) { - slogic->gpd = newdataadr(fd, slogic->gpd); - direct_link_gpencil(fd, slogic->gpd); - } - } else if (sl->spacetype == SPACE_SEQ) { SpaceSeq *sseq = (SpaceSeq *)sl; @@ -7085,13 +6891,6 @@ static void lib_link_area(FileData *fd, bScreen *sc, ScrArea *area) sclip->mask_info.mask = newlibadr_real_us(fd, sc->id.lib, sclip->mask_info.mask); break; } - case SPACE_LOGIC: - { - SpaceLogic *slogic = (SpaceLogic *)sl; - - slogic->gpd = newlibadr_us(fd, sc->id.lib, slogic->gpd); - break; - } default: break; } @@ -7563,11 +7362,6 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main sclip->scopes.ok = 0; } - else if (sl->spacetype == SPACE_LOGIC) { - SpaceLogic *slogic = (SpaceLogic *)sl; - - slogic->gpd = restore_pointer_by_name(id_map, (ID *)slogic->gpd, USER_REAL); - } } } } @@ -9794,9 +9588,6 @@ static void expand_object_expandModifiers( static void expand_object(FileData *fd, Main *mainvar, Object *ob) { ParticleSystem *psys; - bSensor *sens; - bController *cont; - bActuator *act; bActionStrip *strip; PartEff *paf; int a; @@ -9853,84 +9644,6 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) for (psys = ob->particlesystem.first; psys; psys = psys->next) expand_doit(fd, mainvar, psys->part); - for (sens = ob->sensors.first; sens; sens = sens->next) { - if (sens->type == SENS_MESSAGE) { - bMessageSensor *ms = sens->data; - expand_doit(fd, mainvar, ms->fromObject); - } - } - - for (cont = ob->controllers.first; cont; cont = cont->next) { - if (cont->type == CONT_PYTHON) { - bPythonCont *pc = cont->data; - expand_doit(fd, mainvar, pc->text); - } - } - - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_SOUND) { - bSoundActuator *sa = act->data; - expand_doit(fd, mainvar, sa->sound); - } - else if (act->type == ACT_CAMERA) { - bCameraActuator *ca = act->data; - expand_doit(fd, mainvar, ca->ob); - } - else if (act->type == ACT_EDIT_OBJECT) { - bEditObjectActuator *eoa = act->data; - if (eoa) { - expand_doit(fd, mainvar, eoa->ob); - expand_doit(fd, mainvar, eoa->me); - } - } - else if (act->type == ACT_OBJECT) { - bObjectActuator *oa = act->data; - expand_doit(fd, mainvar, oa->reference); - } - else if (act->type == ACT_ADD_OBJECT) { - bAddObjectActuator *aoa = act->data; - expand_doit(fd, mainvar, aoa->ob); - } - else if (act->type == ACT_SCENE) { - bSceneActuator *sa = act->data; - expand_doit(fd, mainvar, sa->camera); - expand_doit(fd, mainvar, sa->scene); - } - else if (act->type == ACT_2DFILTER) { - bTwoDFilterActuator *tdfa = act->data; - expand_doit(fd, mainvar, tdfa->text); - } - else if (act->type == ACT_ACTION) { - bActionActuator *aa = act->data; - expand_doit(fd, mainvar, aa->act); - } - else if (act->type == ACT_SHAPEACTION) { - bActionActuator *aa = act->data; - expand_doit(fd, mainvar, aa->act); - } - else if (act->type == ACT_PROPERTY) { - bPropertyActuator *pa = act->data; - expand_doit(fd, mainvar, pa->ob); - } - else if (act->type == ACT_MESSAGE) { - bMessageActuator *ma = act->data; - expand_doit(fd, mainvar, ma->toObject); - } - else if (act->type==ACT_PARENT) { - bParentActuator *pa = act->data; - expand_doit(fd, mainvar, pa->ob); - } - else if (act->type == ACT_ARMATURE) { - bArmatureActuator *arma = act->data; - expand_doit(fd, mainvar, arma->target); - } - else if (act->type == ACT_STEERING) { - bSteeringActuator *sta = act->data; - expand_doit(fd, mainvar, sta->target); - expand_doit(fd, mainvar, sta->navmesh); - } - } - if (ob->pd) { expand_doit(fd, mainvar, ob->pd->tex); expand_doit(fd, mainvar, ob->pd->f_source); @@ -10040,9 +9753,6 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) } } - if (sce->r.dometext) - expand_doit(fd, mainvar, sce->gm.dome.warptext); - if (sce->gpd) expand_doit(fd, mainvar, sce->gpd); diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index f5a4a33860f..e7f448f6a86 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -39,7 +39,6 @@ #include "DNA_anim_types.h" #include "DNA_armature_types.h" -#include "DNA_actuator_types.h" #include "DNA_brush_types.h" #include "DNA_camera_types.h" #include "DNA_cloth_types.h" @@ -84,7 +83,6 @@ #include "BKE_sequencer.h" #include "BKE_texture.h" #include "BKE_sound.h" -#include "BKE_sca.h" #include "NOD_socket.h" @@ -610,13 +608,7 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb) bConstraint *con; for (con = lb->first; con; con = con->next) { - if (con->type == CONSTRAINT_TYPE_RIGIDBODYJOINT) { - bRigidBodyJointConstraint *data = con->data; - data->axX *= (float)(M_PI / 180.0); - data->axY *= (float)(M_PI / 180.0); - data->axZ *= (float)(M_PI / 180.0); - } - else if (con->type == CONSTRAINT_TYPE_KINEMATIC) { + if (con->type == CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = con->data; data->poleangle *= (float)(M_PI / 180.0); } @@ -750,7 +742,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) bSound *sound; Sequence *seq; - bActuator *act; int a; for (sound = main->sound.first; sound; sound = sound->id.next) { @@ -760,33 +751,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) } } - for (ob = main->object.first; ob; ob = ob->id.next) { - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_SOUND) { - bSoundActuator *sAct = (bSoundActuator*) act->data; - if (sAct->sound) { - sound = blo_do_versions_newlibadr(fd, lib, sAct->sound); - sAct->flag = (sound->flags & SOUND_FLAGS_3D) ? ACT_SND_3D_SOUND : 0; - sAct->pitch = sound->pitch; - sAct->volume = sound->volume; - sAct->sound3D.reference_distance = sound->distance; - sAct->sound3D.max_gain = sound->max_gain; - sAct->sound3D.min_gain = sound->min_gain; - sAct->sound3D.rolloff_factor = sound->attenuation; - } - else { - sAct->sound3D.reference_distance = 1.0f; - sAct->volume = 1.0f; - sAct->sound3D.max_gain = 1.0f; - sAct->sound3D.rolloff_factor = 1.0f; - } - sAct->sound3D.cone_inner_angle = 360.0f; - sAct->sound3D.cone_outer_angle = 360.0f; - sAct->sound3D.max_distance = FLT_MAX; - } - } - } - for (scene = main->scene.first; scene; scene = scene->id.next) { if (scene->ed && scene->ed->seqbasep) { SEQ_BEGIN (scene->ed, seq) @@ -1034,93 +998,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) ts->uv_selectmode = UV_SELECT_VERTEX; ts->vgroup_weight = 1.0f; } - - /* Game Settings */ - /* Dome */ - sce->gm.dome.angle = sce->r.domeangle; - sce->gm.dome.mode = sce->r.domemode; - sce->gm.dome.res = sce->r.domeres; - sce->gm.dome.resbuf = sce->r.domeresbuf; - sce->gm.dome.tilt = sce->r.dometilt; - sce->gm.dome.warptext = sce->r.dometext; - - /* Stand Alone */ - sce->gm.playerflag |= (sce->r.fullscreen ? GAME_PLAYER_FULLSCREEN : 0); - sce->gm.xplay = sce->r.xplay; - sce->gm.yplay = sce->r.yplay; - sce->gm.freqplay = sce->r.freqplay; - sce->gm.depth = sce->r.depth; - sce->gm.attrib = sce->r.attrib; - - /* Stereo */ - sce->gm.stereomode = sce->r.stereomode; - /* reassigning stereomode NO_STEREO and DOME to a separeted flag*/ - if (sce->gm.stereomode == 1) { // 1 = STEREO_NOSTEREO - sce->gm.stereoflag = STEREO_NOSTEREO; - sce->gm.stereomode = STEREO_ANAGLYPH; - } - else if (sce->gm.stereomode == 8) { // 8 = STEREO_DOME - sce->gm.stereoflag = STEREO_DOME; - sce->gm.stereomode = STEREO_ANAGLYPH; - } - else - sce->gm.stereoflag = STEREO_ENABLED; - - /* Framing */ - sce->gm.framing = sce->framing; - sce->gm.xplay = sce->r.xplay; - sce->gm.yplay = sce->r.yplay; - sce->gm.freqplay = sce->r.freqplay; - sce->gm.depth = sce->r.depth; - - /* Physic (previously stored in world) */ - sce->gm.gravity =9.8f; - sce->gm.physicsEngine = WOPHY_BULLET; /* Bullet by default */ - sce->gm.mode = WO_DBVT_CULLING; /* DBVT culling by default */ - sce->gm.occlusionRes = 128; - sce->gm.ticrate = 60; - sce->gm.maxlogicstep = 5; - sce->gm.physubstep = 1; - sce->gm.maxphystep = 5; } } if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 2)) { - Scene *sce; Object *ob; - for (sce = main->scene.first; sce; sce = sce->id.next) { - if (fd->fileflags & G_FILE_ENABLE_ALL_FRAMES) - sce->gm.flag |= GAME_ENABLE_ALL_FRAMES; - if (fd->fileflags & G_FILE_SHOW_DEBUG_PROPS) - sce->gm.flag |= GAME_SHOW_DEBUG_PROPS; - if (fd->fileflags & G_FILE_SHOW_FRAMERATE) - sce->gm.flag |= GAME_SHOW_FRAMERATE; - if (fd->fileflags & G_FILE_SHOW_PHYSICS) - sce->gm.flag |= GAME_SHOW_PHYSICS; - if (fd->fileflags & G_FILE_GLSL_NO_SHADOWS) - sce->gm.flag |= GAME_GLSL_NO_SHADOWS; - if (fd->fileflags & G_FILE_GLSL_NO_SHADERS) - sce->gm.flag |= GAME_GLSL_NO_SHADERS; - if (fd->fileflags & G_FILE_GLSL_NO_RAMPS) - sce->gm.flag |= GAME_GLSL_NO_RAMPS; - if (fd->fileflags & G_FILE_GLSL_NO_NODES) - sce->gm.flag |= GAME_GLSL_NO_NODES; - if (fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX) - sce->gm.flag |= GAME_GLSL_NO_EXTRA_TEX; - if (fd->fileflags & G_FILE_GLSL_NO_ENV_LIGHTING) - sce->gm.flag |= GAME_GLSL_NO_ENV_LIGHTING; - if (fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS) - sce->gm.flag |= GAME_IGNORE_DEPRECATION_WARNINGS; - - if (fd->fileflags & G_FILE_GAME_MAT_GLSL) - sce->gm.matmode = GAME_MAT_GLSL; - else if (fd->fileflags & G_FILE_GAME_MAT) - sce->gm.matmode = GAME_MAT_MULTITEX; - else - sce->gm.matmode = GAME_MAT_TEXFACE; - } - for (ob = main->object.first; ob; ob = ob->id.next) { if (ob->flag & 8192) // OB_POSEMODE = 8192 ob->mode |= OB_MODE_POSE; @@ -1565,16 +1448,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) } if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 12)) { - Scene *sce; Object *ob; Brush *brush; Material *ma; - /* game engine changes */ - for (sce = main->scene.first; sce; sce = sce->id.next) { - sce->gm.eyeseparation = 0.10f; - } - /* anim viz changes */ for (ob = main->object.first; ob; ob = ob->id.next) { /* initialize object defaults */ @@ -2195,7 +2072,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) Brush *br; ParticleSettings *part; bScreen *sc; - Object *ob; for (br = main->brush.first; br; br = br->id.next) { if (br->ob_mode == 0) @@ -2235,41 +2111,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) } } } - - /* fix rotation actuators for objects so they use real angles (radians) - * since before blender went opensource this strange scalar was used: (1 / 0.02) * 2 * math.pi/360 */ - for (ob = main->object.first; ob; ob = ob->id.next) { - bActuator *act = ob->actuators.first; - while (act) { - if (act->type == ACT_OBJECT) { - /* multiply velocity with 50 in old files */ - bObjectActuator *oa = act->data; - mul_v3_fl(oa->drot, 0.8726646259971648f); - } - act = act->next; - } - } - } - - /* init facing axis property of steering actuators */ - { - Object *ob; - for (ob = main->object.first; ob; ob = ob->id.next) { - bActuator *act; - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_STEERING) { - bSteeringActuator *stact = act->data; - if (stact == NULL) {//HG1 - init_actuator(act); - } - else { - if (stact->facingaxis == 0) { - stact->facingaxis = 1; - } - } - } - } - } } if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) { @@ -2562,21 +2403,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) } { - /* add default value for behind strength of camera actuator */ - Object *ob; - bActuator *act; - for (ob = main->object.first; ob; ob = ob->id.next) { - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_CAMERA) { - bCameraActuator *ba = act->data; - - ba->damping = 1.0/32.0; - } - } - } - } - - { ParticleSettings *part; for (part = main->particle.first; part; part = part->id.next) { /* Initialize particle billboard scale */ @@ -2667,50 +2493,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) } } } - - { - /* convert fcurve and shape action actuators to action actuators */ - Object *ob; - bActuator *act; - bIpoActuator *ia; - bActionActuator *aa; - - for (ob = main->object.first; ob; ob = ob->id.next) { - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_IPO) { - /* Create the new actuator */ - ia = act->data; - aa = MEM_callocN(sizeof(bActionActuator), "fcurve -> action actuator do_version"); - - /* Copy values */ - aa->type = ia->type; - aa->flag = ia->flag; - aa->sta = ia->sta; - aa->end = ia->end; - BLI_strncpy(aa->name, ia->name, sizeof(aa->name)); - BLI_strncpy(aa->frameProp, ia->frameProp, sizeof(aa->frameProp)); - if (ob->adt) - aa->act = ob->adt->action; - - /* Get rid of the old actuator */ - MEM_freeN(ia); - - /* Assign the new actuator */ - act->data = aa; - act->type = act->otype = ACT_ACTION; - - /* Fix for converting 2.4x files: if we don't have an action, but we have an - * object IPO, then leave the actuator as an IPO actuator for now and let the - * IPO conversion code handle it */ - if (ob->ipo && !aa->act) - act->type = ACT_IPO; - } - else if (act->type == ACT_SHAPEACTION) { - act->type = act->otype = ACT_ACTION; - } - } - } - } } if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)) { @@ -2758,41 +2540,5 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) part->time_flag &= ~PART_TIME_AUTOSF; } } - - { - /* set defaults for obstacle avoidance, recast data */ - Scene *sce; - for (sce = main->scene.first; sce; sce = sce->id.next) { - if (sce->gm.levelHeight == 0.f) - sce->gm.levelHeight = 2.f; - - if (sce->gm.recastData.cellsize == 0.0f) - sce->gm.recastData.cellsize = 0.3f; - if (sce->gm.recastData.cellheight == 0.0f) - sce->gm.recastData.cellheight = 0.2f; - if (sce->gm.recastData.agentmaxslope == 0.0f) - sce->gm.recastData.agentmaxslope = (float)M_PI/4; - if (sce->gm.recastData.agentmaxclimb == 0.0f) - sce->gm.recastData.agentmaxclimb = 0.9f; - if (sce->gm.recastData.agentheight == 0.0f) - sce->gm.recastData.agentheight = 2.0f; - if (sce->gm.recastData.agentradius == 0.0f) - sce->gm.recastData.agentradius = 0.6f; - if (sce->gm.recastData.edgemaxlen == 0.0f) - sce->gm.recastData.edgemaxlen = 12.0f; - if (sce->gm.recastData.edgemaxerror == 0.0f) - sce->gm.recastData.edgemaxerror = 1.3f; - if (sce->gm.recastData.regionminsize == 0.0f) - sce->gm.recastData.regionminsize = 8.f; - if (sce->gm.recastData.regionmergesize == 0.0f) - sce->gm.recastData.regionmergesize = 20.f; - if (sce->gm.recastData.vertsperpoly<3) - sce->gm.recastData.vertsperpoly = 6; - if (sce->gm.recastData.detailsampledist == 0.0f) - sce->gm.recastData.detailsampledist = 6.0f; - if (sce->gm.recastData.detailsamplemaxerror == 0.0f) - sce->gm.recastData.detailsamplemaxerror = 1.0f; - } - } } } diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 023bd7fe809..89577c7b7d1 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -31,7 +31,6 @@ #define DNA_DEPRECATED_ALLOW #include "DNA_anim_types.h" -#include "DNA_actuator_types.h" #include "DNA_brush_types.h" #include "DNA_camera_types.h" #include "DNA_cloth_types.h" @@ -43,11 +42,9 @@ #include "DNA_meshdata_types.h" #include "DNA_object_fluidsim_types.h" #include "DNA_object_types.h" -#include "DNA_property_types.h" #include "DNA_text_types.h" #include "DNA_view3d_types.h" #include "DNA_screen_types.h" -#include "DNA_sensor_types.h" #include "DNA_sdna_types.h" #include "DNA_smoke_types.h" #include "DNA_space_types.h" @@ -67,7 +64,6 @@ #include "BKE_modifier.h" #include "BKE_particle.h" #include "BKE_pointcache.h" -#include "BKE_property.h" // for BKE_bproperty_object_get #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_sequencer.h" @@ -432,25 +428,6 @@ static void do_versions_nodetree_frame_2_64_6(bNodeTree *ntree) } } -static void do_version_logic_264(ListBase *regionbase) -{ - ARegion *ar; - - /* view settings for logic changed */ - for (ar = regionbase->first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_WINDOW) { - if (ar->v2d.keeptot == 0) { - ar->v2d.maxzoom = 1.5f; - - ar->v2d.keepzoom = V2D_KEEPZOOM | V2D_LIMITZOOM | V2D_KEEPASPECT; - ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS; - ar->v2d.align = V2D_ALIGN_NO_POS_Y | V2D_ALIGN_NO_NEG_X; - ar->v2d.keepofs = V2D_KEEPOFS_Y; - } - } - } -} - static void do_versions_affine_tracker_track(MovieTrackingTrack *track) { int i; @@ -900,14 +877,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) } } { - /* Initialize BGE exit key to esc key */ - Scene *scene; - for (scene = main->scene.first; scene; scene = scene->id.next) { - if (!scene->gm.exitkey) - scene->gm.exitkey = 218; // Blender key code for ESC - } - } - { MovieClip *clip; Object *ob; @@ -943,45 +912,10 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) } } } - { - /* Warn the user if he is using ["Text"] properties for Font objects */ - Object *ob; - bProperty *prop; - - for (ob = main->object.first; ob; ob = ob->id.next) { - if (ob->type == OB_FONT) { - prop = BKE_bproperty_object_get(ob, "Text"); - if (prop) { - blo_reportf_wrap(fd->reports, RPT_WARNING, - TIP_("Game property name conflict in object '%s': text objects reserve the " - "['Text'] game property to change their content through logic bricks"), - ob->id.name + 2); - } - } - } - } } if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 2)) { { - /* convert Camera Actuator values to defines */ - Object *ob; - bActuator *act; - for (ob = main->object.first; ob; ob = ob->id.next) { - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_CAMERA) { - bCameraActuator *ba = act->data; - - if (ba->axis == (float) 'x') ba->axis = OB_POSX; - else if (ba->axis == (float)'y') ba->axis = OB_POSY; - /* don't do an if/else to avoid imediate subversion bump*/ -// ba->axis=((ba->axis == (float)'x') ? OB_POSX_X : OB_POSY); - } - } - } - } - - { /* convert deprecated sculpt_paint_unified_* fields to * UnifiedPaintSettings */ Scene *scene; @@ -1316,19 +1250,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) } } - - if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 8)) { - /* set new deactivation values for game settings */ - Scene *sce; - - for (sce = main->scene.first; sce; sce = sce->id.next) { - /* Game Settings */ - sce->gm.lineardeactthreshold = 0.8f; - sce->gm.angulardeactthreshold = 1.0f; - sce->gm.deactivationtime = 2.0f; - } - } - if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 9)) { FOREACH_NODETREE(main, ntree, id) { if (ntree->type == NTREE_SHADER) { @@ -1738,24 +1659,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) } FOREACH_NODETREE_END } - if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 6)) { - bScreen *sc; - - for (sc = main->screen.first; sc; sc = sc->id.next) { - ScrArea *sa; - for (sa = sc->areabase.first; sa; sa = sa->next) { - SpaceLink *sl; - if ( sa->spacetype == SPACE_LOGIC) - do_version_logic_264(&sa->regionbase); - - for (sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_LOGIC) - do_version_logic_264(&sl->regionbase); - } - } - } - } - if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 7)) { /* convert tiles size from resolution and number of tiles */ { @@ -1809,17 +1712,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) } } - if (main->versionfile < 265) { - Object *ob; - for (ob = main->object.first; ob; ob = ob->id.next) { - if (ob->step_height == 0.0f) { - ob->step_height = 0.15f; - ob->jump_speed = 10.0f; - ob->fall_speed = 55.0f; - } - } - } - if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 3)) { bScreen *sc; for (sc = main->screen.first; sc; sc = sc->id.next) { @@ -2335,32 +2227,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) } } } - - for (ob = main->object.first; ob; ob = ob->id.next) { - bSensor *sens; - bTouchSensor *ts; - bCollisionSensor *cs; - Material *ma; - - for (sens = ob->sensors.first; sens; sens = sens->next) { - if (sens->type == SENS_TOUCH) { - ts = sens->data; - cs = MEM_callocN(sizeof(bCollisionSensor), "touch -> collision sensor do_version"); - - if (ts->ma) { - ma = blo_do_versions_newlibadr(fd, ob->id.lib, ts->ma); - BLI_strncpy(cs->materialName, ma->id.name + 2, sizeof(cs->materialName)); - } - - cs->mode = SENS_COLLISION_MATERIAL; - - MEM_freeN(ts); - - sens->data = cs; - sens->type = sens->otype = SENS_COLLISION; - } - } - } } if (!MAIN_VERSION_ATLEAST(main, 268, 5)) { @@ -2514,10 +2380,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) if (ts->sculpt) ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE; - /* single texture mode removed from game engine */ - if (scene->gm.matmode == GAME_MAT_TEXFACE) - scene->gm.matmode = GAME_MAT_MULTITEX; - /* 'Increment' mode disabled for nodes, use true grid snapping instead */ if (scene->toolsettings->snap_node_mode == SCE_SNAP_MODE_INCREMENT) scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID; @@ -2544,8 +2406,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) for (ob = main->object.first; ob; ob = ob->id.next) { ModifierData *md; - bSensor *bs; - bActuator *ba; for (md = ob->modifiers.first; md; md = md->next) { if (md->type == eModifierType_EdgeSplit) { @@ -2557,28 +2417,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main) bmd->bevel_angle = DEG2RADF(bmd->bevel_angle); } } - - for (bs = ob->sensors.first; bs; bs = bs->next) { - if (bs->type == SENS_RADAR) { - bRadarSensor *brs = bs->data; - brs->angle = DEG2RADF(brs->angle); - } - } - - for (ba = ob->actuators.first; ba; ba = ba->next) { - if (ba->type == ACT_CONSTRAINT) { - bConstraintActuator *bca = ba->data; - if (bca->type == ACT_CONST_TYPE_ORI) { - bca->minloc[0] = DEG2RADF(bca->minloc[0]); - bca->maxloc[0] = DEG2RADF(bca->maxloc[0]); - } - } - else if (ba->type == ACT_SOUND) { - bSoundActuator *bsa = ba->data; - bsa->sound3D.cone_outer_angle = DEG2RADF(bsa->sound3D.cone_outer_angle); - bsa->sound3D.cone_inner_angle = DEG2RADF(bsa->sound3D.cone_inner_angle); - } - } } for (scene = main->scene.first; scene; scene = scene->id.next) { diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 7228c3522f0..e72ed9a41fd 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -52,7 +52,6 @@ #include "DNA_modifier_types.h" #include "DNA_particle_types.h" #include "DNA_linestyle_types.h" -#include "DNA_actuator_types.h" #include "DNA_view3d_types.h" #include "DNA_smoke_types.h" #include "DNA_rigidbody_types.h" @@ -554,29 +553,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } - if (!MAIN_VERSION_ATLEAST(main, 271, 2)) { - /* init up & track axis property of trackto actuators */ - Object *ob; - - for (ob = main->object.first; ob; ob = ob->id.next) { - bActuator *act; - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_EDIT_OBJECT) { - bEditObjectActuator *eoact = act->data; - eoact->trackflag = ob->trackflag; - /* if trackflag is pointing +-Z axis then upflag should point Y axis. - * Rest of trackflag cases, upflag should be point z axis */ - if ((ob->trackflag == OB_POSZ) || (ob->trackflag == OB_NEGZ)) { - eoact->upflag = 1; - } - else { - eoact->upflag = 2; - } - } - } - } - } - if (!MAIN_VERSION_ATLEAST(main, 271, 3)) { Brush *br; @@ -857,13 +833,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } - - if (!DNA_struct_elem_find(fd->filesdna, "GameData", "int", "scehysteresis")) { - Scene *scene; - for (scene = main->scene.first; scene; scene = scene->id.next) { - scene->gm.scehysteresis = 10; - } - } } if (!MAIN_VERSION_ATLEAST(main, 274, 2)) { @@ -1092,16 +1061,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } #undef LA_YF_PHOTON } - - { - Object *ob; - for (ob = main->object.first; ob; ob = ob->id.next) { - if (ob->body_type == OB_BODY_TYPE_CHARACTER && (ob->gameflag & OB_BOUNDS) && ob->collision_boundtype == OB_BOUND_TRIANGLE_MESH) { - ob->boundtype = ob->collision_boundtype = OB_BOUND_BOX; - } - } - } - } if (!MAIN_VERSION_ATLEAST(main, 276, 3)) { @@ -1212,12 +1171,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) else gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS; } - - if (!DNA_struct_elem_find(fd->filesdna, "Object", "unsigned char", "max_jumps")) { - for (Object *ob = main->object.first; ob; ob = ob->id.next) { - ob->max_jumps = 1; - } - } } if (!MAIN_VERSION_ATLEAST(main, 276, 5)) { ListBase *lbarray[MAX_LIBARRAY]; diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 50b7f736a67..71074aef9b6 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -38,6 +38,7 @@ #include "DNA_object_types.h" #include "DNA_camera_types.h" +#include "DNA_constraint_types.h" #include "DNA_gpu_types.h" #include "DNA_group_types.h" #include "DNA_lamp_types.h" @@ -53,6 +54,7 @@ #include "DNA_workspace_types.h" #include "BKE_collection.h" +#include "BKE_constraint.h" #include "BKE_customdata.h" #include "BKE_freestyle.h" #include "BKE_group.h" @@ -314,7 +316,7 @@ void do_versions_after_linking_280(Main *main) scene->active_view_layer = 0; /* Handle legacy render layers. */ - if (!BKE_scene_uses_blender_game(scene)) { + { for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) { ViewLayer *view_layer = BKE_view_layer_add(scene, srl->name); @@ -419,15 +421,6 @@ void do_versions_after_linking_280(Main *main) scene->active_view_layer = scene->r.actlay; } } - else { - for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) { - if (srl->prop) { - IDP_FreeProperty(srl->prop); - MEM_freeN(srl->prop); - } - BKE_freestyle_config_free(&srl->freestyleConfig, true); - } - } BLI_freelistN(&scene->r.layers); ViewLayer *view_layer = BKE_view_layer_add(scene, "Viewport"); @@ -900,7 +893,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main) } } - { + if (!MAIN_VERSION_ATLEAST(main, 280, 6)) { if (DNA_struct_elem_find(fd->filesdna, "SpaceOops", "int", "filter") == false) { bScreen *sc; ScrArea *sa; @@ -932,11 +925,27 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main) } } - { + if (!MAIN_VERSION_ATLEAST(main, 280, 6)) { if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "intensity")) { for (LightProbe *probe = main->lightprobe.first; probe; probe = probe->id.next) { probe->intensity = 1.0f; } } } + + if (!MAIN_VERSION_ATLEAST(main, 280, 6)) { + for (Object *ob = main->object.first; ob; ob = ob->id.next) { + bConstraint *con, *con_next; + con = ob->constraints.first; + while (con) { + con_next = con->next; + if (con->type == 17) { /* CONSTRAINT_TYPE_RIGIDBODYJOINT */ + BLI_remlink(&ob->constraints, con); + BKE_constraint_free_data(con); + MEM_freeN(con); + } + con = con_next; + } + } + } } diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index b09c7d77e59..74becdc67da 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -210,9 +210,6 @@ void BLO_update_defaults_startup_blend(Main *bmain) pset->brush[PE_BRUSH_CUT].strength = 1.0f; } - scene->gm.lodflag |= SCE_LOD_USE_HYST; - scene->gm.scehysteresis = 10; - scene->r.ffcodecdata.audio_mixrate = 48000; } diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index b8744b71812..b1b24b8d0e6 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -45,7 +45,6 @@ #define DNA_DEPRECATED_ALLOW #include "DNA_armature_types.h" -#include "DNA_actuator_types.h" #include "DNA_camera_types.h" #include "DNA_constraint_types.h" #include "DNA_effect_types.h" @@ -60,10 +59,8 @@ #include "DNA_node_types.h" #include "DNA_object_fluidsim_types.h" #include "DNA_object_types.h" -#include "DNA_property_types.h" #include "DNA_view3d_types.h" #include "DNA_screen_types.h" -#include "DNA_sensor_types.h" #include "DNA_sdna_types.h" #include "DNA_sequence_types.h" #include "DNA_sound_types.h" @@ -90,7 +87,6 @@ #include "BKE_modifier.h" #include "BKE_particle.h" #include "BKE_pointcache.h" -#include "BKE_property.h" // for BKE_bproperty_object_get #include "BKE_scene.h" #include "BKE_sequencer.h" @@ -128,38 +124,6 @@ static void vcol_to_fcol(Mesh *me) me->mcol = (MCol *)mcolmain; } -static int map_223_keybd_code_to_224_keybd_code(int code) -{ - switch (code) { - case 312: - return 311; /* F12KEY */ - case 159: - return 161; /* PADSLASHKEY */ - case 161: - return 150; /* PAD0 */ - case 154: - return 151; /* PAD1 */ - case 150: - return 152; /* PAD2 */ - case 155: - return 153; /* PAD3 */ - case 151: - return 154; /* PAD4 */ - case 156: - return 155; /* PAD5 */ - case 152: - return 156; /* PAD6 */ - case 157: - return 157; /* PAD7 */ - case 153: - return 158; /* PAD8 */ - case 158: - return 159; /* PAD9 */ - default: - return code; - } -} - static void do_version_bone_head_tail_237(Bone *bone) { Bone *child; @@ -833,7 +797,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } if (main->versionfile <= 191) { - Object *ob = main->object.first; Material *ma = main->mat.first; /* let faces have default add factor of 0.0 */ @@ -842,121 +805,10 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) ma->add = 0.0; ma = ma->id.next; } - - while (ob) { - ob->mass = 1.0f; - ob->damping = 0.1f; - /*ob->quat[1] = 1.0f;*/ /* quats arnt used yet */ - ob = ob->id.next; - } - } - - if (main->versionfile <= 193) { - Object *ob = main->object.first; - while (ob) { - ob->inertia = 1.0f; - ob->rdamping = 0.1f; - ob = ob->id.next; - } - } - - if (main->versionfile <= 200) { - Object *ob = main->object.first; - while (ob) { - ob->scaflag = ob->gameflag & (OB_DO_FH|OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS); - /* 64 is do_fh */ - ob->gameflag &= ~(OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS); - ob = ob->id.next; - } - } - - if (main->versionfile <= 201) { - /* add-object + end-object are joined to edit-object actuator */ - Object *ob = main->object.first; - bProperty *prop; - bActuator *act; - bIpoActuator *ia; - bEditObjectActuator *eoa; - bAddObjectActuator *aoa; - while (ob) { - act = ob->actuators.first; - while (act) { - if (act->type == ACT_IPO) { - ia = act->data; - prop = BKE_bproperty_object_get(ob, ia->name); - if (prop) { - ia->type = ACT_IPO_FROM_PROP; - } - } - else if (act->type == ACT_ADD_OBJECT) { - aoa = act->data; - eoa = MEM_callocN(sizeof(bEditObjectActuator), "edit ob act"); - eoa->type = ACT_EDOB_ADD_OBJECT; - eoa->ob = aoa->ob; - eoa->time = aoa->time; - MEM_freeN(aoa); - act->data = eoa; - act->type = act->otype = ACT_EDIT_OBJECT; - } - else if (act->type == ACT_END_OBJECT) { - eoa = MEM_callocN(sizeof(bEditObjectActuator), "edit ob act"); - eoa->type = ACT_EDOB_END_OBJECT; - act->data = eoa; - act->type = act->otype = ACT_EDIT_OBJECT; - } - act = act->next; - } - ob = ob->id.next; - } - } - - if (main->versionfile <= 202) { - /* add-object and end-object are joined to edit-object - * actuator */ - Object *ob = main->object.first; - bActuator *act; - bObjectActuator *oa; - while (ob) { - act = ob->actuators.first; - while (act) { - if (act->type == ACT_OBJECT) { - oa = act->data; - oa->flag &= ~(ACT_TORQUE_LOCAL|ACT_DROT_LOCAL); /* this actuator didn't do local/glob rot before */ - } - act = act->next; - } - ob = ob->id.next; - } } if (main->versionfile <= 204) { - /* patches for new physics */ - Object *ob = main->object.first; - bActuator *act; - bObjectActuator *oa; bSound *sound; - while (ob) { - - /* please check this for demo20 files like - * original Egypt levels etc. converted - * rotation factor of 50 is not workable */ - act = ob->actuators.first; - while (act) { - if (act->type == ACT_OBJECT) { - oa = act->data; - - oa->forceloc[0] *= 25.0f; - oa->forceloc[1] *= 25.0f; - oa->forceloc[2] *= 25.0f; - - oa->forcerot[0] *= 10.0f; - oa->forcerot[1] *= 10.0f; - oa->forcerot[2] *= 10.0f; - } - act = act->next; - } - ob = ob->id.next; - } sound = main->sound.first; while (sound) { @@ -967,120 +819,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile <= 205) { - /* patches for new physics */ - Object *ob = main->object.first; - bActuator *act; - bSensor *sens; - bEditObjectActuator *oa; - bRaySensor *rs; - bCollisionSensor *cs; - while (ob) { - /* Set anisotropic friction off for old objects, - * values to 1.0. */ - ob->gameflag &= ~OB_ANISOTROPIC_FRICTION; - ob->anisotropicFriction[0] = 1.0; - ob->anisotropicFriction[1] = 1.0; - ob->anisotropicFriction[2] = 1.0; - - act = ob->actuators.first; - while (act) { - if (act->type == ACT_EDIT_OBJECT) { - /* Zero initial velocity for newly - * added objects */ - oa = act->data; - oa->linVelocity[0] = 0.0; - oa->linVelocity[1] = 0.0; - oa->linVelocity[2] = 0.0; - oa->localflag = 0; - } - act = act->next; - } - - sens = ob->sensors.first; - while (sens) { - /* Extra fields for radar sensors. */ - if (sens->type == SENS_RADAR) { - bRadarSensor *s = sens->data; - s->range = 10000.0; - } - - /* Pulsing: defaults for new sensors. */ - if (sens->type != SENS_ALWAYS) { - sens->pulse = 0; - sens->freq = 0; - } - else { - sens->pulse = 1; - } - - /* Invert: off. */ - sens->invert = 0; - - /* Collision and ray: default = trigger - * on property. The material field can - * remain empty. */ - if (sens->type == SENS_COLLISION) { - cs = (bCollisionSensor*) sens->data; - cs->mode = 0; - } - if (sens->type == SENS_RAY) { - rs = (bRaySensor*) sens->data; - rs->mode = 0; - } - sens = sens->next; - } - ob = ob->id.next; - } - /* have to check the exact multiplier */ - } - - if (main->versionfile <= 211) { - /* Render setting: per scene, the applicable gamma value - * can be set. Default is 1.0, which means no - * correction. */ - bActuator *act; - bObjectActuator *oa; - Object *ob; - - /* added alpha in obcolor */ - ob = main->object.first; - while (ob) { - ob->col[3] = 1.0; - ob = ob->id.next; - } - - /* added alpha in obcolor */ - ob = main->object.first; - while (ob) { - act = ob->actuators.first; - while (act) { - if (act->type == ACT_OBJECT) { - /* multiply velocity with 50 in old files */ - oa = act->data; - if (fabsf(oa->linearvelocity[0]) >= 0.01f) - oa->linearvelocity[0] *= 50.0f; - if (fabsf(oa->linearvelocity[1]) >= 0.01f) - oa->linearvelocity[1] *= 50.0f; - if (fabsf(oa->linearvelocity[2]) >= 0.01f) - oa->linearvelocity[2] *= 50.0f; - if (fabsf(oa->angularvelocity[0]) >= 0.01f) - oa->angularvelocity[0] *= 50.0f; - if (fabsf(oa->angularvelocity[1]) >= 0.01f) - oa->angularvelocity[1] *= 50.0f; - if (fabsf(oa->angularvelocity[2]) >= 0.01f) - oa->angularvelocity[2] *= 50.0f; - } - act = act->next; - } - ob = ob->id.next; - } - } - if (main->versionfile <= 212) { bSound *sound; - bProperty *prop; - Object *ob; Mesh *me; sound = main->sound.first; @@ -1097,21 +837,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) sound = sound->id.next; } - ob = main->object.first; - - while (ob) { - prop = ob->prop.first; - while (prop) { - if (prop->type == GPROP_TIME) { - // convert old GPROP_TIME values from int to float - *((float *)&prop->data) = (float) prop->data; - } - - prop = prop->next; - } - ob = ob->id.next; - } - /* me->subdiv changed to reflect the actual reparametization * better, and smeshes were removed - if it was a smesh make * it a subsurf, and reset the subdiv level because subsurf @@ -1134,29 +859,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } if (main->versionfile <= 220) { - Object *ob; Mesh *me; - ob = main->object.first; - - /* adapt form factor in order to get the 'old' physics - * behavior back... - */ - - while (ob) { - /* in future, distinguish between different - * object bounding shapes - */ - ob->formfactor = 0.4f; - /* patch form factor, note that inertia equiv radius - * of a rotation symmetrical obj - */ - if (ob->inertia != 1.0f) { - ob->formfactor /= ob->inertia * ob->inertia; - } - ob = ob->id.next; - } - /* Began using alpha component of vertex colors, but * old file vertex colors are undefined, reset them * to be fully opaque. -zr @@ -1214,7 +918,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) if (main->versionfile <= 223) { VFont *vf; Image *ima; - Object *ob; for (vf = main->vfont.first; vf; vf = vf->id.next) { if (STREQ(vf->name + strlen(vf->name) - 6, ".Bfont")) { @@ -1226,21 +929,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) for (ima = main->image.first; ima; ima = ima->id.next) { ima->animspeed = 25; } - - /* Zr remapped some keyboard codes to be linear (stupid zr) */ - for (ob = main->object.first; ob; ob = ob->id.next) { - bSensor *sens; - - for (sens = ob->sensors.first; sens; sens = sens->next) { - if (sens->type == SENS_KEYBOARD) { - bKeyboardSensor *ks = sens->data; - - ks->key = map_223_keybd_code_to_224_keybd_code(ks->key); - ks->qual = map_223_keybd_code_to_224_keybd_code(ks->qual); - ks->qual2 = map_223_keybd_code_to_224_keybd_code(ks->qual2); - } - } - } } if (main->versionfile <= 224) { @@ -1284,14 +972,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile <= 225) { - World *wo; - /* Use Sumo for old games */ - for (wo = main->world.first; wo; wo = wo->id.next) { - wo->physicsEngine = 2; - } - } - if (main->versionfile <= 227) { Scene *sce; Material *ma; @@ -1469,9 +1149,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) sbuts->mainb = CONTEXT_SCENE; //sbuts->tab[CONTEXT_SCENE] = TAB_SCENE_RENDER; } - else if (sbuts->mainb == BUTS_GAME) { - sbuts->mainb = CONTEXT_LOGIC; - } else if (sbuts->mainb == BUTS_FPAINT) { sbuts->mainb = CONTEXT_EDITING; } @@ -1729,15 +1406,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } if (main->versionfile <= 234) { - World *wo; bScreen *sc; - /* force sumo engine to be active */ - for (wo = main->world.first; wo; wo = wo->id.next) { - if (wo->physicsEngine == 0) - wo->physicsEngine = 2; - } - for (sc = main->screen.first; sc; sc = sc->id.next) { ScrArea *sa; for (sa = sc->areabase.first; sa; sa = sa->next) { @@ -2122,10 +1792,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) bNodeTree *ntree; for (wo = main->world.first; wo; wo = wo->id.next) { - /* Migrate to Bullet for games, except for the NaN versions */ - /* People can still explicitly choose for Sumo (after 2.42 is out) */ - if (main->versionfile > 225) - wo->physicsEngine = WOPHY_BULLET; if (WO_AODIST == wo->aomode) wo->aocolor = WO_AOPLAIN; } @@ -3163,25 +2829,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) idproperties_fix_group_lengths(main->particle); } - /* sun/sky */ - if (main->versionfile < 246) { - Object *ob; - bActuator *act; - - /* dRot actuator change direction in 2.46 */ - for (ob = main->object.first; ob; ob = ob->id.next) { - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_OBJECT) { - bObjectActuator *ba = act->data; - - ba->drot[0] = -ba->drot[0]; - ba->drot[1] = -ba->drot[1]; - ba->drot[2] = -ba->drot[2]; - } - } - } - } - /* convert fluids to modifier */ if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) { Object *ob; @@ -3211,25 +2858,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 2)) { - Object *ob; - for (ob = main->object.first; ob; ob = ob->id.next) { - ob->gameflag |= OB_COLLISION; - ob->margin = 0.06f; - } - } - - if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)) { - Object *ob; - for (ob = main->object.first; ob; ob = ob->id.next) { - /* Starting from subversion 3, ACTOR is a separate feature. - * Before it was conditioning all the other dynamic flags */ - if (!(ob->gameflag & OB_ACTOR)) - ob->gameflag &= ~(OB_GHOST|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION_RESPONSE); - /* suitable default for older files */ - } - } - if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 5)) { Lamp *la = main->lamp.first; for (; la; la = la->id.next) { @@ -3261,23 +2889,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } } - /* direction constraint actuators were always local in previous version */ - if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 7)) { - bActuator *act; - Object *ob; - - for (ob = main->object.first; ob; ob = ob->id.next) { - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_CONSTRAINT) { - bConstraintActuator *coa = act->data; - if (coa->type == ACT_CONST_TYPE_DIST) { - coa->flag |= ACT_CONST_LOCAL; - } - } - } - } - } - if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 9)) { Lamp *la = main->lamp.first; for (; la; la = la->id.next) { @@ -3285,28 +2896,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } } - /* BGE message actuators needed OB prefix, very confusing */ - if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 10)) { - bActuator *act; - Object *ob; - - for (ob = main->object.first; ob; ob = ob->id.next) { - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_MESSAGE) { - bMessageActuator *msgAct = (bMessageActuator *) act->data; - - if (BLI_strnlen(msgAct->toPropName, 3) > 2) { - /* strip first 2 chars, would have only worked if these were OB anyway */ - memmove(msgAct->toPropName, msgAct->toPropName + 2, sizeof(msgAct->toPropName) - 2); - } - else { - msgAct->toPropName[0] = '\0'; - } - } - } - } - } - if (main->versionfile < 248) { Lamp *la; @@ -3400,60 +2989,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) } } - if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 3)) { - Object *ob; - - /* Adjustments needed after Bullets update */ - for (ob = main->object.first; ob; ob = ob->id.next) { - ob->damping *= 0.635f; - ob->rdamping = 0.1f + (0.8f * ob->rdamping); - } - } - - if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 4)) { - Scene *sce; - World *wrld; - - /* Dome (Fisheye) default parameters */ - for (sce = main->scene.first; sce; sce = sce->id.next) { - sce->r.domeangle = 180; - sce->r.domemode = 1; - sce->r.domeres = 4; - sce->r.domeresbuf = 1.0f; - sce->r.dometilt = 0; - } - /* DBVT culling by default */ - for (wrld = main->world.first; wrld; wrld = wrld->id.next) { - wrld->mode |= WO_DBVT_CULLING; - wrld->occlusionRes = 128; - } - } - - if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 5)) { - Object *ob; - World *wrld; - for (ob = main->object.first; ob; ob = ob->id.next) { - if (ob->parent) { - /* check if top parent has compound shape set and if yes, set this object - * to compound shaper as well (was the behavior before, now it's optional) */ - Object *parent = blo_do_versions_newlibadr(fd, lib, ob->parent); - while (parent && parent != ob && parent->parent != NULL) { - parent = blo_do_versions_newlibadr(fd, lib, parent->parent); - } - if (parent) { - if (parent->gameflag & OB_CHILD) - ob->gameflag |= OB_CHILD; - } - } - } - for (wrld = main->world.first; wrld; wrld = wrld->id.next) { - wrld->ticrate = 60; - wrld->maxlogicstep = 5; - wrld->physubstep = 1; - wrld->maxphystep = 5; - } - } - /* correct introduce of seed for wind force */ if (main->versionfile < 249 && main->subversionfile < 1) { Object *ob; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index c1c165bb523..c6523dc99e2 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -109,13 +109,11 @@ #include "DNA_anim_types.h" #include "DNA_armature_types.h" -#include "DNA_actuator_types.h" #include "DNA_brush_types.h" #include "DNA_cachefile_types.h" #include "DNA_camera_types.h" #include "DNA_cloth_types.h" #include "DNA_constraint_types.h" -#include "DNA_controller_types.h" #include "DNA_dynamicpaint_types.h" #include "DNA_genfile.h" #include "DNA_group_types.h" @@ -136,12 +134,10 @@ #include "DNA_packedFile_types.h" #include "DNA_particle_types.h" #include "DNA_lightprobe_types.h" -#include "DNA_property_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" #include "DNA_sdna_types.h" #include "DNA_sequence_types.h" -#include "DNA_sensor_types.h" #include "DNA_smoke_types.h" #include "DNA_space_types.h" #include "DNA_screen_types.h" @@ -1466,180 +1462,6 @@ static void write_particlesystems(WriteData *wd, ListBase *particles) } } -static void write_properties(WriteData *wd, ListBase *lb) -{ - bProperty *prop; - - prop = lb->first; - while (prop) { - writestruct(wd, DATA, bProperty, 1, prop); - - if (prop->poin && prop->poin != &prop->data) { - writedata(wd, DATA, MEM_allocN_len(prop->poin), prop->poin); - } - - prop = prop->next; - } -} - -static void write_sensors(WriteData *wd, ListBase *lb) -{ - bSensor *sens; - - sens = lb->first; - while (sens) { - writestruct(wd, DATA, bSensor, 1, sens); - - writedata(wd, DATA, sizeof(void *) * sens->totlinks, sens->links); - - switch (sens->type) { - case SENS_NEAR: - writestruct(wd, DATA, bNearSensor, 1, sens->data); - break; - case SENS_MOUSE: - writestruct(wd, DATA, bMouseSensor, 1, sens->data); - break; - case SENS_KEYBOARD: - writestruct(wd, DATA, bKeyboardSensor, 1, sens->data); - break; - case SENS_PROPERTY: - writestruct(wd, DATA, bPropertySensor, 1, sens->data); - break; - case SENS_ARMATURE: - writestruct(wd, DATA, bArmatureSensor, 1, sens->data); - break; - case SENS_ACTUATOR: - writestruct(wd, DATA, bActuatorSensor, 1, sens->data); - break; - case SENS_DELAY: - writestruct(wd, DATA, bDelaySensor, 1, sens->data); - break; - case SENS_COLLISION: - writestruct(wd, DATA, bCollisionSensor, 1, sens->data); - break; - case SENS_RADAR: - writestruct(wd, DATA, bRadarSensor, 1, sens->data); - break; - case SENS_RANDOM: - writestruct(wd, DATA, bRandomSensor, 1, sens->data); - break; - case SENS_RAY: - writestruct(wd, DATA, bRaySensor, 1, sens->data); - break; - case SENS_MESSAGE: - writestruct(wd, DATA, bMessageSensor, 1, sens->data); - break; - case SENS_JOYSTICK: - writestruct(wd, DATA, bJoystickSensor, 1, sens->data); - break; - default: - ; /* error: don't know how to write this file */ - } - - sens = sens->next; - } -} - -static void write_controllers(WriteData *wd, ListBase *lb) -{ - bController *cont; - - cont = lb->first; - while (cont) { - writestruct(wd, DATA, bController, 1, cont); - - writedata(wd, DATA, sizeof(void *) * cont->totlinks, cont->links); - - switch (cont->type) { - case CONT_EXPRESSION: - writestruct(wd, DATA, bExpressionCont, 1, cont->data); - break; - case CONT_PYTHON: - writestruct(wd, DATA, bPythonCont, 1, cont->data); - break; - default: - ; /* error: don't know how to write this file */ - } - - cont = cont->next; - } -} - -static void write_actuators(WriteData *wd, ListBase *lb) -{ - bActuator *act; - - act = lb->first; - while (act) { - writestruct(wd, DATA, bActuator, 1, act); - - switch (act->type) { - case ACT_ACTION: - case ACT_SHAPEACTION: - writestruct(wd, DATA, bActionActuator, 1, act->data); - break; - case ACT_SOUND: - writestruct(wd, DATA, bSoundActuator, 1, act->data); - break; - case ACT_OBJECT: - writestruct(wd, DATA, bObjectActuator, 1, act->data); - break; - case ACT_PROPERTY: - writestruct(wd, DATA, bPropertyActuator, 1, act->data); - break; - case ACT_CAMERA: - writestruct(wd, DATA, bCameraActuator, 1, act->data); - break; - case ACT_CONSTRAINT: - writestruct(wd, DATA, bConstraintActuator, 1, act->data); - break; - case ACT_EDIT_OBJECT: - writestruct(wd, DATA, bEditObjectActuator, 1, act->data); - break; - case ACT_SCENE: - writestruct(wd, DATA, bSceneActuator, 1, act->data); - break; - case ACT_GROUP: - writestruct(wd, DATA, bGroupActuator, 1, act->data); - break; - case ACT_RANDOM: - writestruct(wd, DATA, bRandomActuator, 1, act->data); - break; - case ACT_MESSAGE: - writestruct(wd, DATA, bMessageActuator, 1, act->data); - break; - case ACT_GAME: - writestruct(wd, DATA, bGameActuator, 1, act->data); - break; - case ACT_VISIBILITY: - writestruct(wd, DATA, bVisibilityActuator, 1, act->data); - break; - case ACT_2DFILTER: - writestruct(wd, DATA, bTwoDFilterActuator, 1, act->data); - break; - case ACT_PARENT: - writestruct(wd, DATA, bParentActuator, 1, act->data); - break; - case ACT_STATE: - writestruct(wd, DATA, bStateActuator, 1, act->data); - break; - case ACT_ARMATURE: - writestruct(wd, DATA, bArmatureActuator, 1, act->data); - break; - case ACT_STEERING: - writestruct(wd, DATA, bSteeringActuator, 1, act->data); - break; - case ACT_MOUSE: - writestruct(wd, DATA, bMouseActuator, 1, act->data); - break; - default: - ; /* error: don't know how to write this file */ - } - - act = act->next; - } -} - static void write_motionpath(WriteData *wd, bMotionPath *mpath) { /* sanity checks */ @@ -1954,10 +1776,6 @@ static void write_object(WriteData *wd, Object *ob) writedata(wd, DATA, sizeof(void *) * ob->totcol, ob->mat); writedata(wd, DATA, sizeof(char) * ob->totcol, ob->matbits); /* write_effects(wd, &ob->effect); */ /* not used anymore */ - write_properties(wd, &ob->prop); - write_sensors(wd, &ob->sensors); - write_controllers(wd, &ob->controllers); - write_actuators(wd, &ob->actuators); if (ob->type == OB_ARMATURE) { bArmature *arm = ob->data; @@ -1978,7 +1796,6 @@ static void write_object(WriteData *wd, Object *ob) write_pointcaches(wd, &ob->soft->ptcaches); writestruct(wd, DATA, EffectorWeights, 1, ob->soft->effector_weights); } - writestruct(wd, DATA, BulletSoftBody, 1, ob->bsoft); if (ob->rigidbody_object) { /* TODO: if any extra data is added to handle duplis, will need separate function then */ @@ -3089,9 +2906,6 @@ static void write_area_regions(WriteData *wd, ScrArea *area) writestruct(wd, DATA, bNodeTreePath, 1, path); } } - else if (sl->spacetype == SPACE_LOGIC) { - writestruct(wd, DATA, SpaceLogic, 1, sl); - } else if (sl->spacetype == SPACE_CONSOLE) { SpaceConsole *con = (SpaceConsole *)sl; ConsoleLine *cl; diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt index 06f412b7019..619b031e27a 100644 --- a/source/blender/editors/CMakeLists.txt +++ b/source/blender/editors/CMakeLists.txt @@ -49,7 +49,6 @@ if(WITH_BLENDER) add_subdirectory(space_graph) add_subdirectory(space_image) add_subdirectory(space_info) - add_subdirectory(space_logic) add_subdirectory(space_nla) add_subdirectory(space_node) add_subdirectory(space_outliner) diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 3523e27f6ba..db19bc48fb3 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -233,7 +233,6 @@ int ED_operator_sequencer_active(struct bContext *C); int ED_operator_sequencer_active_editable(struct bContext *C); int ED_operator_image_active(struct bContext *C); int ED_operator_nla_active(struct bContext *C); -int ED_operator_logic_active(struct bContext *C); int ED_operator_info_active(struct bContext *C); int ED_operator_console_active(struct bContext *C); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index edf15d02e73..d85c77d55fb 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -268,8 +268,6 @@ typedef enum { UI_BTYPE_SCROLL = (18 << 9), UI_BTYPE_BLOCK = (19 << 9), UI_BTYPE_LABEL = (20 << 9), - UI_BTYPE_LINK = (22 << 9), - UI_BTYPE_INLINK = (23 << 9), UI_BTYPE_KEY_EVENT = (24 << 9), UI_BTYPE_HSVCUBE = (26 << 9), UI_BTYPE_PULLDOWN = (27 << 9), /* menu (often used in headers), **_MENU /w different draw-type */ @@ -704,16 +702,6 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block, struct wmOperatorType *ot, struct IDP uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2); int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align); -/* Links - * - * Game engine logic brick links. Non-functional currently in 2.5, - * code to handle and draw these is disabled internally. */ - -void UI_but_link_set(struct uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to); - -void UI_block_links_compose(uiBlock *block); -uiBut *UI_block_links_find_inlink(uiBlock *block, void *poin); - /* use inside searchfunc to add items */ bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid); /* bfunc gets search item *poin as arg2, or if NULL the old string */ @@ -973,8 +961,6 @@ void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int color); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *used_ptr, const char *used_propname, int active_layer); -void uiTemplateGameStates(uiLayout *layout, struct PointerRNA *ptr, const char *propname, - PointerRNA *used_ptr, const char *used_propname, int active_state); void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact, int multiview); void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management); void uiTemplateImageStereo3d(uiLayout *layout, struct PointerRNA *stereo3d_format_ptr); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a98d62be3ca..20eb0ce50e5 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -510,87 +510,6 @@ static int ui_but_calc_float_precision(uiBut *but, double value) return UI_calc_float_precision(prec, value); } -/* ************** LINK LINE DRAWING ************* */ - -/* link line drawing is not part of buttons or theme.. so we stick with it here */ - -static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines, int dashInactiveLines) -{ - rcti rect; - float color[4] = {1.0f}; - - if (line->from == NULL || line->to == NULL) return; - - rect.xmin = BLI_rctf_cent_x(&line->from->rect); - rect.ymin = BLI_rctf_cent_y(&line->from->rect); - rect.xmax = BLI_rctf_cent_x(&line->to->rect); - rect.ymax = BLI_rctf_cent_y(&line->to->rect); - - if (dashInactiveLines) - UI_GetThemeColor4fv(TH_GRID, color); - else if (line->flag & UI_SELECT) - rgba_float_args_set_ch(color, 100, 100, 100, 255); - else if (highlightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE))) - UI_GetThemeColor4fv(TH_TEXT_HI, color); - else - rgba_float_args_set_ch(color, 0, 0, 0, 255); - - ui_draw_link_bezier(&rect, color); -} - -static void ui_draw_links(uiBlock *block) -{ - uiBut *but; - uiLinkLine *line; - - /* Draw the gray out lines. Do this first so they appear at the - * bottom of inactive or active lines. - * As we go, remember if we see any active or selected lines. */ - bool found_selectline = false; - bool found_activeline = false; - - for (but = block->buttons.first; but; but = but->next) { - if (but->type == UI_BTYPE_LINK && but->link) { - for (line = but->link->lines.first; line; line = line->next) { - if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE)) { - if (line->deactive) - ui_draw_linkline(line, 0, true); - } - else - found_activeline = true; - - if ((line->from->flag & UI_SELECT) || (line->to->flag & UI_SELECT)) - found_selectline = true; - } - } - } - - /* Draw the inactive lines (lines with neither button being hovered over) */ - for (but = block->buttons.first; but; but = but->next) { - if (but->type == UI_BTYPE_LINK && but->link) { - for (line = but->link->lines.first; line; line = line->next) { - if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE)) { - if (!line->deactive) - ui_draw_linkline(line, 0, false); - } - } - } - } - - /* Draw any active lines (lines with either button being hovered over). - * Do this last so they appear on top of inactive and gray out lines. */ - if (found_activeline) { - for (but = block->buttons.first; but; but = but->next) { - if (but->type == UI_BTYPE_LINK && but->link) { - for (line = but->link->lines.first; line; line = line->next) { - if ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)) - ui_draw_linkline(line, !found_selectline, false); - } - } - } - } -} - /* ************** BLOCK ENDING FUNCTION ************* */ /* NOTE: if but->poin is allocated memory for every defbut, things fail... */ @@ -633,38 +552,6 @@ uiBut *ui_but_find_new(uiBlock *block_new, const uiBut *but_old) return but_new; } -/* oldbut is being inserted in new block, so we use the lines from new button, and replace button pointers */ -static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut) -{ - uiLinkLine *line; - uiBut *but; - - /* if active button is UI_BTYPE_LINK */ - if (newbut->type == UI_BTYPE_LINK && newbut->link) { - - SWAP(uiLink *, oldbut->link, newbut->link); - - for (line = oldbut->link->lines.first; line; line = line->next) { - if (line->to == newbut) - line->to = oldbut; - if (line->from == newbut) - line->from = oldbut; - } - } - - /* check all other button links */ - for (but = block->buttons.first; but; but = but->next) { - if (but != newbut && but->type == UI_BTYPE_LINK && but->link) { - for (line = but->link->lines.first; line; line = line->next) { - if (line->to == newbut) - line->to = oldbut; - if (line->from == newbut) - line->from = oldbut; - } - } - } -} - /** * \return true when \a but_p is set (only done for active buttons). */ @@ -764,8 +651,6 @@ static bool ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBu oldbut->a1 = but->a1; } - ui_but_update_linklines(block, oldbut, but); - if (!BLI_listbase_is_empty(&block->butstore)) { UI_butstore_register_update(block, oldbut, but); } @@ -1453,8 +1338,6 @@ void UI_block_draw(const bContext *C, uiBlock *block) /* restore matrix */ gpuPopProjectionMatrix(); gpuPopMatrix(); - - ui_draw_links(block); } static void ui_block_message_subscribe(ARegion *ar, struct wmMsgBus *mbus, uiBlock *block) @@ -1573,83 +1456,6 @@ static void ui_but_update_select_flag(uiBut *but, double *value) } } -static uiBut *ui_linkline_find_inlink(uiBlock *block, void *poin) -{ - uiBut *but; - - but = block->buttons.first; - while (but) { - if (but->type == UI_BTYPE_INLINK) { - if (but->poin == poin) return but; - } - but = but->next; - } - return NULL; -} - -static void ui_linkline_add(ListBase *listb, uiBut *but, uiBut *bt, short deactive) -{ - uiLinkLine *line; - - line = MEM_callocN(sizeof(uiLinkLine), "linkline"); - BLI_addtail(listb, line); - line->from = but; - line->to = bt; - line->deactive = deactive; -} - -uiBut *UI_block_links_find_inlink(uiBlock *block, void *poin) -{ - return ui_linkline_find_inlink(block, poin); -} - -void UI_block_links_compose(uiBlock *block) -{ - uiBut *but, *bt; - uiLink *link; - void ***ppoin; - int a; - - but = block->buttons.first; - while (but) { - if (but->type == UI_BTYPE_LINK) { - link = but->link; - - /* for all pointers in the array */ - if (link) { - if (link->ppoin) { - ppoin = link->ppoin; - for (a = 0; a < *(link->totlink); a++) { - bt = ui_linkline_find_inlink(block, (*ppoin)[a]); - if (bt) { - if ((but->flag & UI_BUT_SCA_LINK_GREY) || (bt->flag & UI_BUT_SCA_LINK_GREY)) { - ui_linkline_add(&link->lines, but, bt, true); - } - else { - ui_linkline_add(&link->lines, but, bt, false); - } - - } - } - } - else if (link->poin) { - bt = ui_linkline_find_inlink(block, *link->poin); - if (bt) { - if ((but->flag & UI_BUT_SCA_LINK_GREY) || (bt->flag & UI_BUT_SCA_LINK_GREY)) { - ui_linkline_add(&link->lines, but, bt, true); - } - else { - ui_linkline_add(&link->lines, but, bt, false); - } - } - } - } - } - but = but->next; - } -} - - /* ************************************************ */ void UI_block_lock_set(uiBlock *block, bool val, const char *lockstr) @@ -1666,44 +1472,6 @@ void UI_block_lock_clear(uiBlock *block) block->lockstr = NULL; } -/* *************************************************************** */ - -void ui_linkline_remove(uiLinkLine *line, uiBut *but) -{ - uiLink *link; - int a, b; - - BLI_remlink(&but->link->lines, line); - - link = line->from->link; - - /* are there more pointers allowed? */ - if (link->ppoin) { - - if (*(link->totlink) == 1) { - *(link->totlink) = 0; - MEM_freeN(*(link->ppoin)); - *(link->ppoin) = NULL; - } - else { - b = 0; - for (a = 0; a < (*(link->totlink)); a++) { - if ((*(link->ppoin))[a] != line->to->poin) { - (*(link->ppoin))[b] = (*(link->ppoin))[a]; - b++; - } - } - (*(link->totlink))--; - } - } - else { - *(link->poin) = NULL; - } - - MEM_freeN(line); - //REDRAW -} - /* *********************** data get/set *********************** * this either works with the pointed to data, or can work with * an edit override pointer while dragging for example */ @@ -2788,14 +2556,6 @@ static void ui_set_but_soft_range(uiBut *but) /* ******************* Free ********************/ -static void ui_free_link(uiLink *link) -{ - if (link) { - BLI_freelistN(&link->lines); - MEM_freeN(link); - } -} - /* can be called with C==NULL */ static void ui_but_free(const bContext *C, uiBut *but) { @@ -2836,7 +2596,6 @@ static void ui_but_free(const bContext *C, uiBut *but) if (but->str && but->str != but->strdata) { MEM_freeN(but->str); } - ui_free_link(but->link); if ((but->type == UI_BTYPE_IMAGE) && but->poin) { IMB_freeImBuf((struct ImBuf *)but->poin); @@ -4113,19 +3872,6 @@ uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcon /* END Button containing both string label and icon */ -void UI_but_link_set(uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to) -{ - uiLink *link; - - link = but->link = MEM_callocN(sizeof(uiLink), "new uilink"); - - link->poin = poin; - link->ppoin = ppoin; - link->totlink = tot; - link->fromcode = from; - link->tocode = to; -} - /* cruft to make uiBlock and uiBut private */ int UI_blocklist_min_y_get(ListBase *lb) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 11f78967315..63fe440b36c 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -39,9 +39,6 @@ #include "MEM_guardedalloc.h" #include "DNA_brush_types.h" -#include "DNA_sensor_types.h" -#include "DNA_controller_types.h" -#include "DNA_actuator_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -117,8 +114,6 @@ #define USE_KEYMAP_ADD_HACK /* proto */ -static void ui_but_smart_controller_add(bContext *C, uiBut *from, uiBut *to); -static void ui_but_link_add(bContext *C, uiBut *from, uiBut *to); static int ui_do_but_EXIT(bContext *C, uiBut *but, struct uiHandleButtonData *data, const wmEvent *event); static bool ui_but_find_select_in_enum__cmp(const uiBut *but_a, const uiBut *but_b); static void ui_textedit_string_set(uiBut *but, struct uiHandleButtonData *data, const char *str); @@ -724,8 +719,7 @@ static void ui_apply_but_undo(uiBut *but) const char *str = NULL; /* define which string to use for undo */ - if (ELEM(but->type, UI_BTYPE_LINK, UI_BTYPE_INLINK)) str = "Add button link"; - else if (but->type == UI_BTYPE_MENU) str = but->drawstr; + if (but->type == UI_BTYPE_MENU) str = but->drawstr; else if (but->drawstr[0]) str = but->drawstr; else str = but->tip; @@ -1782,223 +1776,6 @@ static bool ui_but_drag_init( /* ********************** linklines *********************** */ -static void ui_linkline_remove_active(uiBlock *block) -{ - uiBut *but; - uiLink *link; - uiLinkLine *line, *nline; - int a, b; - - for (but = block->buttons.first; but; but = but->next) { - if (but->type == UI_BTYPE_LINK && but->link) { - for (line = but->link->lines.first; line; line = nline) { - nline = line->next; - - if (line->flag & UI_SELECT) { - BLI_remlink(&but->link->lines, line); - - link = line->from->link; - - /* are there more pointers allowed? */ - if (link->ppoin) { - - if (*(link->totlink) == 1) { - *(link->totlink) = 0; - MEM_freeN(*(link->ppoin)); - *(link->ppoin) = NULL; - } - else { - b = 0; - for (a = 0; a < (*(link->totlink)); a++) { - - if ((*(link->ppoin))[a] != line->to->poin) { - (*(link->ppoin))[b] = (*(link->ppoin))[a]; - b++; - } - } - (*(link->totlink))--; - } - } - else { - *(link->poin) = NULL; - } - - MEM_freeN(line); - } - } - } - } -} - - -static uiLinkLine *ui_but_find_link(uiBut *from, uiBut *to) -{ - uiLinkLine *line; - uiLink *link; - - link = from->link; - if (link) { - for (line = link->lines.first; line; line = line->next) { - if (line->from == from && line->to == to) { - return line; - } - } - } - return NULL; -} - -/* XXX BAD BAD HACK, fixme later **************** */ -/* Try to add an AND Controller between the sensor and the actuator logic bricks and to connect them all */ -static void ui_but_smart_controller_add(bContext *C, uiBut *from, uiBut *to) -{ - Object *ob = NULL; - bSensor *sens_iter; - bActuator *act_to, *act_iter; - bController *cont; - bController ***sens_from_links; - uiBut *tmp_but; - - uiLink *link = from->link; - - PointerRNA props_ptr, object_ptr; - - if (link->ppoin) - sens_from_links = (bController ***)(link->ppoin); - else return; - - act_to = (bActuator *)(to->poin); - - /* (1) get the object */ - CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) - { - for (sens_iter = ob_iter->sensors.first; sens_iter; sens_iter = sens_iter->next) { - if (&(sens_iter->links) == sens_from_links) { - ob = ob_iter; - break; - } - } - if (ob) break; - } CTX_DATA_END; - - if (!ob) return; - - /* (2) check if the sensor and the actuator are from the same object */ - for (act_iter = ob->actuators.first; act_iter; act_iter = (bActuator *)act_iter->next) { - if (act_iter == act_to) - break; - } - - /* only works if the sensor and the actuator are from the same object */ - if (!act_iter) return; - - /* in case the linked controller is not the active one */ - RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); - - WM_operator_properties_create(&props_ptr, "LOGIC_OT_controller_add"); - RNA_string_set(&props_ptr, "object", ob->id.name + 2); - - /* (3) add a new controller */ - if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, &props_ptr) & OPERATOR_FINISHED) { - cont = (bController *)ob->controllers.last; - /* Quick fix to make sure we always have an AND controller. - * It might be nicer to make sure the operator gives us the right one though... */ - cont->type = CONT_LOGIC_AND; - - /* (4) link the sensor->controller->actuator */ - tmp_but = MEM_callocN(sizeof(uiBut), "uiBut"); - UI_but_link_set( - tmp_but, (void **)&cont, (void ***)&(cont->links), - &cont->totlinks, from->link->tocode, (int)to->hardmin); - tmp_but->hardmin = from->link->tocode; - tmp_but->poin = (char *)cont; - - tmp_but->type = UI_BTYPE_INLINK; - ui_but_link_add(C, from, tmp_but); - - tmp_but->type = UI_BTYPE_LINK; - ui_but_link_add(C, tmp_but, to); - - /* (5) garbage collection */ - MEM_freeN(tmp_but->link); - MEM_freeN(tmp_but); - } - WM_operator_properties_free(&props_ptr); -} - -static void ui_but_link_add(bContext *C, uiBut *from, uiBut *to) -{ - /* in 'from' we have to add a link to 'to' */ - uiLink *link; - uiLinkLine *line; - void **oldppoin; - int a; - - if ((line = ui_but_find_link(from, to))) { - line->flag |= UI_SELECT; - ui_linkline_remove_active(from->block); - return; - } - - if (from->type == UI_BTYPE_INLINK && to->type == UI_BTYPE_INLINK) { - return; - } - else if (from->type == UI_BTYPE_LINK && to->type == UI_BTYPE_INLINK) { - if (from->link->tocode != (int)to->hardmin) { - ui_but_smart_controller_add(C, from, to); - return; - } - } - else if (from->type == UI_BTYPE_INLINK && to->type == UI_BTYPE_LINK) { - if (to->link->tocode == (int)from->hardmin) { - return; - } - } - - link = from->link; - - /* are there more pointers allowed? */ - if (link->ppoin) { - oldppoin = *(link->ppoin); - - (*(link->totlink))++; - *(link->ppoin) = MEM_callocN(*(link->totlink) * sizeof(void *), "new link"); - - for (a = 0; a < (*(link->totlink)) - 1; a++) { - (*(link->ppoin))[a] = oldppoin[a]; - } - (*(link->ppoin))[a] = to->poin; - - if (oldppoin) MEM_freeN(oldppoin); - } - else { - *(link->poin) = to->poin; - } - -} - - -static void ui_apply_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data) -{ - ARegion *ar = CTX_wm_region(C); - uiBut *bt; - - for (bt = but->block->buttons.first; bt; bt = bt->next) { - if (ui_but_contains_point_px(ar, bt, but->linkto[0] + ar->winrct.xmin, but->linkto[1] + ar->winrct.ymin) ) - break; - } - if (bt && bt != but) { - if (!ELEM(bt->type, UI_BTYPE_LINK, UI_BTYPE_INLINK) || !ELEM(but->type, UI_BTYPE_LINK, UI_BTYPE_INLINK)) - return; - - if (but->type == UI_BTYPE_LINK) ui_but_link_add(C, but, bt); - else ui_but_link_add(C, bt, but); - - ui_apply_but_func(C, but); - data->retval = but->retval; - } - data->applied = true; -} - static void ui_apply_but_IMAGE(bContext *C, uiBut *but, uiHandleButtonData *data) { ui_apply_but_func(C, but); @@ -2153,10 +1930,6 @@ static void ui_apply_but(bContext *C, uiBlock *block, uiBut *but, uiHandleButton case UI_BTYPE_HOTKEY_EVENT: ui_apply_but_BUT(C, but, data); break; - case UI_BTYPE_LINK: - case UI_BTYPE_INLINK: - ui_apply_but_LINK(C, but, data); - break; case UI_BTYPE_IMAGE: ui_apply_but_IMAGE(C, but, data); break; @@ -6445,35 +6218,6 @@ static int ui_do_but_WAVEFORM( return WM_UI_HANDLER_CONTINUE; } -static int ui_do_but_LINK( - bContext *C, uiBut *but, - uiHandleButtonData *data, const wmEvent *event) -{ - VECCOPY2D(but->linkto, event->mval); - - if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (event->type == LEFTMOUSE && event->val == KM_PRESS) { - button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE); - return WM_UI_HANDLER_BREAK; - } - else if (event->type == LEFTMOUSE && but->block->handle) { - button_activate_state(C, but, BUTTON_STATE_EXIT); - return WM_UI_HANDLER_BREAK; - } - } - else if (data->state == BUTTON_STATE_WAIT_RELEASE) { - - if (event->type == LEFTMOUSE && event->val != KM_PRESS) { - if (!(but->flag & UI_SELECT)) - data->cancel = true; - button_activate_state(C, but, BUTTON_STATE_EXIT); - return WM_UI_HANDLER_BREAK; - } - } - - return WM_UI_HANDLER_CONTINUE; -} - static bool ui_numedit_but_TRACKPREVIEW( bContext *C, uiBut *but, uiHandleButtonData *data, int mx, int my, @@ -7289,10 +7033,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * case UI_BTYPE_HSVCIRCLE: retval = ui_do_but_HSVCIRCLE(C, block, but, data, event); break; - case UI_BTYPE_LINK: - case UI_BTYPE_INLINK: - retval = ui_do_but_LINK(C, but, data, event); - break; case UI_BTYPE_TRACK_PREVIEW: retval = ui_do_but_TRACKPREVIEW(C, block, but, data, event); break; @@ -8520,12 +8260,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) break; } case MOUSEMOVE: - if (ELEM(but->type, UI_BTYPE_LINK, UI_BTYPE_INLINK)) { - but->flag |= UI_SELECT; - ui_do_button(C, block, but, event); - ED_region_tag_redraw(ar); - } - else { + { /* deselect the button when moving the mouse away */ /* also de-activate for buttons that only show higlights */ if (ui_but_contains_point_px(ar, but, event->x, event->y)) { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index bb9bfdd4429..0d2a8da265d 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -270,9 +270,6 @@ struct uiBut { uiButHandleHoldFunc hold_func; void *hold_argN; - uiLink *link; - short linkto[2]; /* region relative coords */ - const char *tip; uiButToolTipFunc tip_func; void *tip_argN; @@ -451,8 +448,6 @@ typedef struct uiSafetyRct { /* interface.c */ -extern void ui_linkline_remove(uiLinkLine *line, uiBut *but); - void ui_fontscale(short *points, float aspect); extern bool ui_block_is_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 375027a84d0..ae2b8c8060c 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -70,7 +70,6 @@ #include "BKE_particle.h" #include "BKE_paint.h" #include "BKE_report.h" -#include "BKE_sca.h" #include "BKE_screen.h" #include "DEG_depsgraph.h" @@ -1316,8 +1315,7 @@ static uiLayout *draw_modifier( UI_block_emboss_set(block, UI_EMBOSS_NONE); /* When Modifier is a simulation, show button to switch to context rather than the delete button. */ if (modifier_can_delete(md) && - (!modifier_is_simulation(md) || - STREQ(scene->view_render.engine_id, RE_engine_id_BLENDER_GAME))) + !modifier_is_simulation(md)) { uiItemO(row, "", ICON_X, "OBJECT_OT_modifier_remove"); } @@ -2927,77 +2925,6 @@ void uiTemplateLayers( } } -void uiTemplateGameStates( - uiLayout *layout, PointerRNA *ptr, const char *propname, - PointerRNA *used_ptr, const char *used_propname, int active_state) -{ - uiLayout *uRow, *uCol; - PropertyRNA *prop, *used_prop = NULL; - int groups, cols, states; - int group, col, state, row; - int cols_per_group = 5; - Object *ob = (Object *)ptr->id.data; - - prop = RNA_struct_find_property(ptr, propname); - if (!prop) { - RNA_warning("states property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); - return; - } - - /* the number of states determines the way we group them - * - we want 2 rows only (for now) - * - the number of columns (cols) is the total number of buttons per row - * the 'remainder' is added to this, as it will be ok to have first row slightly wider if need be - * - for now, only split into groups if group will have at least 5 items - */ - states = RNA_property_array_length(ptr, prop); - cols = (states / 2) + (states % 2); - groups = ((cols / 2) < cols_per_group) ? (1) : (cols / cols_per_group); - - if (used_ptr && used_propname) { - used_prop = RNA_struct_find_property(used_ptr, used_propname); - if (!used_prop) { - RNA_warning("used layers property not found: %s.%s", RNA_struct_identifier(ptr->type), used_propname); - return; - } - - if (RNA_property_array_length(used_ptr, used_prop) < states) - used_prop = NULL; - } - - /* layers are laid out going across rows, with the columns being divided into groups */ - - for (group = 0; group < groups; group++) { - uCol = uiLayoutColumn(layout, true); - - for (row = 0; row < 2; row++) { - uiBlock *block; - uiBut *but; - - uRow = uiLayoutRow(uCol, true); - block = uiLayoutGetBlock(uRow); - state = groups * cols_per_group * row + cols_per_group * group; - - /* add layers as toggle buts */ - for (col = 0; (col < cols_per_group) && (state < states); col++, state++) { - int icon = 0; - int butlay = 1 << state; - - if (active_state & butlay) - icon = ICON_LAYER_ACTIVE; - else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, state)) - icon = ICON_LAYER_USED; - - but = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2, ptr, prop, - state, 0, 0, -1, -1, sca_state_name_get(ob, state)); - UI_but_func_set(but, handle_layer_buttons, but, SET_INT_IN_POINTER(state)); - but->type = UI_BTYPE_TOGGLE; - } - } - } -} - - /************************* List Template **************************/ static void uilist_draw_item_default( struct uiList *ui_list, struct bContext *UNUSED(C), struct uiLayout *layout, diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d72e59beb91..71eb764918d 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -3177,36 +3177,6 @@ bool ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol) return true; } -#define LINK_RESOL 24 -void ui_draw_link_bezier(const rcti *rect, const float color[4]) -{ - float coord_array[LINK_RESOL + 1][2]; - - if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - -#if 0 /* unused */ - /* we can reuse the dist variable here to increment the GL curve eval amount*/ - const float dist = 1.0f / (float)LINK_RESOL; -#endif - glEnable(GL_BLEND); - glEnable(GL_LINE_SMOOTH); - - immUniformColor4fv(color); - - immBegin(GWN_PRIM_LINE_STRIP, LINK_RESOL + 1); - for (int i = 0; i <= LINK_RESOL; ++i) - immVertex2fv(pos, coord_array[i]); - immEnd(); - - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - - immUnbindProgram(); - } -} - /* function in use for buttons and for view2d sliders */ void UI_draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *slider, int state) { @@ -3380,24 +3350,6 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int rect->xmax += (BLI_rcti_size_x(&rect_prog) / 2); } -static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) -{ - - if (but->flag & UI_SELECT) { - rcti rectlink; - float color[4]; - - UI_GetThemeColor4fv(TH_TEXT_HI, color); - - rectlink.xmin = BLI_rcti_cent_x(rect); - rectlink.ymin = BLI_rcti_cent_y(rect); - rectlink.xmax = but->linkto[0]; - rectlink.ymax = but->linkto[1]; - - ui_draw_link_bezier(&rectlink, color); - } -} - static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) { uiWidgetBase wtb, wtb1; @@ -4342,14 +4294,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct case UI_BTYPE_LISTBOX: wt = widget_type(UI_WTYPE_BOX); break; - - case UI_BTYPE_LINK: - case UI_BTYPE_INLINK: - wt = widget_type(UI_WTYPE_ICON); - wt->custom = widget_link; - - break; - + case UI_BTYPE_EXTRA: widget_draw_extra_mask(C, but, widget_type(UI_WTYPE_BOX), rect); break; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index de9469a48cb..d13b7e8ea74 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -162,9 +162,6 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo case SPACE_NODE: ts = &btheme->tnode; break; - case SPACE_LOGIC: - ts = &btheme->tlogic; - break; case SPACE_CLIP: ts = &btheme->tclip; break; @@ -1210,10 +1207,6 @@ void ui_theme_init_default(void) rgba_char_args_set(btheme->tnode.console_output, 223, 202, 53, 255); /* interface nodes */ btheme->tnode.noodle_curving = 5; - /* space logic */ - btheme->tlogic = btheme->tv3d; - rgba_char_args_set(btheme->tlogic.back, 100, 100, 100, 255); - /* space clip */ btheme->tclip = btheme->tv3d; @@ -2104,13 +2097,6 @@ void init_userdef_do_versions(void) if (btheme->tui.wcol_num.outline[3] == 0) ui_widget_color_init(&btheme->tui); - - /* Logic editor theme, check for alpha==0 is safe, then color was never set */ - if (btheme->tlogic.syntaxn[3] == 0) { - /* re-uses syntax color storage */ - btheme->tlogic = btheme->tv3d; - rgba_char_args_set(btheme->tlogic.back, 100, 100, 100, 255); - } rgba_char_args_set_fl(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0); rgba_char_args_set_fl(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0); @@ -2924,9 +2910,6 @@ void init_userdef_do_versions(void) U.transopts &= ~( USER_TR_DEPRECATED_2 | USER_TR_DEPRECATED_3 | USER_TR_DEPRECATED_4 | USER_TR_DEPRECATED_6 | USER_TR_DEPRECATED_7); - U.gameflags &= ~( - USER_GL_RENDER_DEPRECATED_0 | USER_GL_RENDER_DEPRECATED_1 | - USER_GL_RENDER_DEPRECATED_3 | USER_GL_RENDER_DEPRECATED_4); U.uiflag |= USER_LOCK_CURSOR_ADJUST; } diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index eae6b7192d7..91656bf6bd0 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -68,18 +68,6 @@ set(SRC mesh_intern.h ) -if(WITH_GAMEENGINE) - add_definitions(-DWITH_GAMEENGINE) - - list(APPEND INC - ../../../../extern/recastnavigation - ) - - list(APPEND SRC - mesh_navmesh.c - ) -endif() - if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 99342222d52..788887e872a 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -254,12 +254,4 @@ void MESH_OT_customdata_custom_splitnormals_clear(struct wmOperatorType *ot); void MESH_OT_drop_named_image(struct wmOperatorType *ot); -/* *** mesh_navmesh.c *** */ -void MESH_OT_navmesh_make(struct wmOperatorType *ot); -void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot); -void MESH_OT_navmesh_face_add(struct wmOperatorType *ot); -void MESH_OT_navmesh_reset(struct wmOperatorType *ot); -void MESH_OT_navmesh_clear(struct wmOperatorType *ot); - - #endif /* __MESH_INTERN_H__ */ diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c deleted file mode 100644 index c94015de0f6..00000000000 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ /dev/null @@ -1,736 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2011 by Blender Foundation - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): Benoit Bolsee, - * Nick Samarin - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/editors/mesh/mesh_navmesh.c - * \ingroup edmesh - */ - -#include "MEM_guardedalloc.h" - -#include "DNA_scene_types.h" -#include "DNA_object_types.h" -#include "DNA_mesh_types.h" - -#include "BLI_listbase.h" -#include "BLI_math_vector.h" -#include "BLI_linklist.h" - -#include "BKE_layer.h" -#include "BKE_library.h" -#include "BKE_context.h" -#include "BKE_mesh.h" -#include "BKE_scene.h" -#include "BKE_DerivedMesh.h" -#include "BKE_report.h" -#include "BKE_editmesh.h" - -#include "ED_object.h" -#include "ED_mesh.h" -#include "ED_screen.h" - -#include "WM_api.h" -#include "WM_types.h" - -#include "recast-capi.h" - -#include "DEG_depsgraph.h" - -#include "mesh_intern.h" /* own include */ - - -static void createVertsTrisData(bContext *C, LinkNode *obs, - int *nverts_r, float **verts_r, int *ntris_r, int **tris_r, unsigned int *r_lay) -{ - MVert *mvert; - int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces; - MFace *mface; - float co[3], wco[3]; - Object *ob; - LinkNode *oblink, *dmlink; - DerivedMesh *dm; - Depsgraph *depsgraph = CTX_data_depsgraph(C); - Scene *scene = CTX_data_scene(C); - LinkNodePair dms_pair = {NULL, NULL}; - - int nverts, ntris, *tris; - float *verts; - - nverts = 0; - ntris = 0; - - /* calculate number of verts and tris */ - for (oblink = obs; oblink; oblink = oblink->next) { - ob = (Object *) oblink->link; - dm = mesh_create_derived_no_virtual(depsgraph, scene, ob, NULL, CD_MASK_MESH); - DM_ensure_tessface(dm); - BLI_linklist_append(&dms_pair, dm); - - nverts += dm->getNumVerts(dm); - nfaces = dm->getNumTessFaces(dm); - ntris += nfaces; - - /* resolve quad faces */ - mface = dm->getTessFaceArray(dm); - for (i = 0; i < nfaces; i++) { - MFace *mf = &mface[i]; - if (mf->v4) - ntris += 1; - } - - *r_lay |= ob->lay; - } - LinkNode *dms = dms_pair.list; - - /* create data */ - verts = MEM_mallocN(sizeof(float) * 3 * nverts, "createVertsTrisData verts"); - tris = MEM_mallocN(sizeof(int) * 3 * ntris, "createVertsTrisData faces"); - - basenverts = 0; - tri = tris; - for (oblink = obs, dmlink = dms; oblink && dmlink; - oblink = oblink->next, dmlink = dmlink->next) - { - ob = (Object *) oblink->link; - dm = (DerivedMesh *) dmlink->link; - - curnverts = dm->getNumVerts(dm); - mvert = dm->getVertArray(dm); - - /* copy verts */ - for (i = 0; i < curnverts; i++) { - MVert *v = &mvert[i]; - - copy_v3_v3(co, v->co); - mul_v3_m4v3(wco, ob->obmat, co); - - verts[3 * (basenverts + i) + 0] = wco[0]; - verts[3 * (basenverts + i) + 1] = wco[2]; - verts[3 * (basenverts + i) + 2] = wco[1]; - } - - /* create tris */ - curnfaces = dm->getNumTessFaces(dm); - mface = dm->getTessFaceArray(dm); - - for (i = 0; i < curnfaces; i++) { - MFace *mf = &mface[i]; - - tri[0] = basenverts + mf->v1; - tri[1] = basenverts + mf->v3; - tri[2] = basenverts + mf->v2; - tri += 3; - - if (mf->v4) { - tri[0] = basenverts + mf->v1; - tri[1] = basenverts + mf->v4; - tri[2] = basenverts + mf->v3; - tri += 3; - } - } - - basenverts += curnverts; - } - - /* release derived mesh */ - for (dmlink = dms; dmlink; dmlink = dmlink->next) { - dm = (DerivedMesh *) dmlink->link; - dm->release(dm); - } - - BLI_linklist_free(dms, NULL); - - *nverts_r = nverts; - *verts_r = verts; - *ntris_r = ntris; - *tris_r = tris; -} - -static bool buildNavMesh(const RecastData *recastParams, int nverts, float *verts, int ntris, int *tris, - struct recast_polyMesh **pmesh, struct recast_polyMeshDetail **dmesh, - ReportList *reports) -{ - float bmin[3], bmax[3]; - struct recast_heightfield *solid; - unsigned char *triflags; - struct recast_compactHeightfield *chf; - struct recast_contourSet *cset; - int width, height, walkableHeight, walkableClimb, walkableRadius; - int minRegionArea, mergeRegionArea, maxEdgeLen; - float detailSampleDist, detailSampleMaxError; - - recast_calcBounds(verts, nverts, bmin, bmax); - - /* ** Step 1. Initialize build config ** */ - walkableHeight = (int)ceilf(recastParams->agentheight / recastParams->cellheight); - walkableClimb = (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight); - walkableRadius = (int)ceilf(recastParams->agentradius / recastParams->cellsize); - minRegionArea = (int)(recastParams->regionminsize * recastParams->regionminsize); - mergeRegionArea = (int)(recastParams->regionmergesize * recastParams->regionmergesize); - maxEdgeLen = (int)(recastParams->edgemaxlen / recastParams->cellsize); - detailSampleDist = recastParams->detailsampledist < 0.9f ? 0 : - recastParams->cellsize * recastParams->detailsampledist; - detailSampleMaxError = recastParams->cellheight * recastParams->detailsamplemaxerror; - - /* Set the area where the navigation will be build. */ - recast_calcGridSize(bmin, bmax, recastParams->cellsize, &width, &height); - - /* zero dimensions cause zero alloc later on [#33758] */ - if (width <= 0 || height <= 0) { - BKE_report(reports, RPT_ERROR, "Object has a width or height of zero"); - return false; - } - - /* ** Step 2: Rasterize input polygon soup ** */ - /* Allocate voxel heightfield where we rasterize our input data to */ - solid = recast_newHeightfield(); - - if (!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) { - recast_destroyHeightfield(solid); - BKE_report(reports, RPT_ERROR, "Failed to create height field"); - return false; - } - - /* Allocate array that can hold triangle flags */ - triflags = MEM_callocN(sizeof(unsigned char) * ntris, "buildNavMesh triflags"); - - /* Find triangles which are walkable based on their slope and rasterize them */ - recast_markWalkableTriangles(RAD2DEGF(recastParams->agentmaxslope), verts, nverts, tris, ntris, triflags); - recast_rasterizeTriangles(verts, nverts, tris, triflags, ntris, solid, 1); - MEM_freeN(triflags); - - /* ** Step 3: Filter walkables surfaces ** */ - recast_filterLowHangingWalkableObstacles(walkableClimb, solid); - recast_filterLedgeSpans(walkableHeight, walkableClimb, solid); - recast_filterWalkableLowHeightSpans(walkableHeight, solid); - - /* ** Step 4: Partition walkable surface to simple regions ** */ - - chf = recast_newCompactHeightfield(); - if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) { - recast_destroyHeightfield(solid); - recast_destroyCompactHeightfield(chf); - - BKE_report(reports, RPT_ERROR, "Failed to create compact height field"); - return false; - } - - recast_destroyHeightfield(solid); - solid = NULL; - - if (!recast_erodeWalkableArea(walkableRadius, chf)) { - recast_destroyCompactHeightfield(chf); - - BKE_report(reports, RPT_ERROR, "Failed to erode walkable area"); - return false; - } - - if (recastParams->partitioning == RC_PARTITION_WATERSHED) { - /* Prepare for region partitioning, by calculating distance field along the walkable surface */ - if (!recast_buildDistanceField(chf)) { - recast_destroyCompactHeightfield(chf); - - BKE_report(reports, RPT_ERROR, "Failed to build distance field"); - return false; - } - - /* Partition the walkable surface into simple regions without holes */ - if (!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) { - recast_destroyCompactHeightfield(chf); - - BKE_report(reports, RPT_ERROR, "Failed to build watershed regions"); - return false; - } - } - else if (recastParams->partitioning == RC_PARTITION_MONOTONE) { - /* Partition the walkable surface into simple regions without holes */ - /* Monotone partitioning does not need distancefield. */ - if (!recast_buildRegionsMonotone(chf, 0, minRegionArea, mergeRegionArea)) { - recast_destroyCompactHeightfield(chf); - - BKE_report(reports, RPT_ERROR, "Failed to build monotone regions"); - return false; - } - } - else { /* RC_PARTITION_LAYERS */ - /* Partition the walkable surface into simple regions without holes */ - if (!recast_buildLayerRegions(chf, 0, minRegionArea)) { - recast_destroyCompactHeightfield(chf); - - BKE_report(reports, RPT_ERROR, "Failed to build layer regions"); - return false; - } - } - - /* ** Step 5: Trace and simplify region contours ** */ - /* Create contours */ - cset = recast_newContourSet(); - - if (!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset, RECAST_CONTOUR_TESS_WALL_EDGES)) { - recast_destroyCompactHeightfield(chf); - recast_destroyContourSet(cset); - - BKE_report(reports, RPT_ERROR, "Failed to build contours"); - return false; - } - - /* ** Step 6: Build polygons mesh from contours ** */ - *pmesh = recast_newPolyMesh(); - if (!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) { - recast_destroyCompactHeightfield(chf); - recast_destroyContourSet(cset); - recast_destroyPolyMesh(*pmesh); - - BKE_report(reports, RPT_ERROR, "Failed to build poly mesh"); - return false; - } - - - /* ** Step 7: Create detail mesh which allows to access approximate height on each polygon ** */ - - *dmesh = recast_newPolyMeshDetail(); - if (!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) { - recast_destroyCompactHeightfield(chf); - recast_destroyContourSet(cset); - recast_destroyPolyMesh(*pmesh); - recast_destroyPolyMeshDetail(*dmesh); - - BKE_report(reports, RPT_ERROR, "Failed to build poly mesh detail"); - return false; - } - - recast_destroyCompactHeightfield(chf); - recast_destroyContourSet(cset); - - return true; -} - -static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, - Base *base, unsigned int lay) -{ - float co[3], rot[3]; - BMEditMesh *em; - int i, j, k; - unsigned short *v; - int face[3]; - ViewLayer *view_layer = CTX_data_view_layer(C); - Object *obedit; - int createob = base == NULL; - int nverts, nmeshes, nvp; - unsigned short *verts, *polys; - unsigned int *meshes; - float bmin[3], cs, ch, *dverts; - unsigned char *tris; - - zero_v3(co); - zero_v3(rot); - - if (createob) { - /* create new object */ - obedit = ED_object_add_type(C, OB_MESH, "Navmesh", co, rot, false, lay); - } - else { - obedit = base->object; - BKE_view_layer_base_deselect_all(view_layer); - BKE_view_layer_base_select(view_layer, base); - copy_v3_v3(obedit->loc, co); - copy_v3_v3(obedit->rot, rot); - } - - ED_object_editmode_enter(C, EM_DO_UNDO | EM_IGNORE_LAYER); - em = BKE_editmesh_from_object(obedit); - - if (!createob) { - /* clear */ - EDBM_mesh_clear(em); - } - - /* create verts for polygon mesh */ - verts = recast_polyMeshGetVerts(pmesh, &nverts); - recast_polyMeshGetBoundbox(pmesh, bmin, NULL); - recast_polyMeshGetCell(pmesh, &cs, &ch); - - for (i = 0; i < nverts; i++) { - v = &verts[3 * i]; - co[0] = bmin[0] + v[0] * cs; - co[1] = bmin[1] + v[1] * ch; - co[2] = bmin[2] + v[2] * cs; - SWAP(float, co[1], co[2]); - BM_vert_create(em->bm, co, NULL, BM_CREATE_NOP); - } - - /* create custom data layer to save polygon idx */ - CustomData_add_layer_named(&em->bm->pdata, CD_RECAST, CD_CALLOC, NULL, 0, "createRepresentation recastData"); - CustomData_bmesh_init_pool(&em->bm->pdata, 0, BM_FACE); - - /* create verts and faces for detailed mesh */ - meshes = recast_polyMeshDetailGetMeshes(dmesh, &nmeshes); - polys = recast_polyMeshGetPolys(pmesh, NULL, &nvp); - dverts = recast_polyMeshDetailGetVerts(dmesh, NULL); - tris = recast_polyMeshDetailGetTris(dmesh, NULL); - - for (i = 0; i < nmeshes; i++) { - int uniquevbase = em->bm->totvert; - unsigned int vbase = meshes[4 * i + 0]; - unsigned short ndv = meshes[4 * i + 1]; - unsigned short tribase = meshes[4 * i + 2]; - unsigned short trinum = meshes[4 * i + 3]; - const unsigned short *p = &polys[i * nvp * 2]; - int nv = 0; - - for (j = 0; j < nvp; ++j) { - if (p[j] == 0xffff) break; - nv++; - } - - /* create unique verts */ - for (j = nv; j < ndv; j++) { - copy_v3_v3(co, &dverts[3 * (vbase + j)]); - SWAP(float, co[1], co[2]); - BM_vert_create(em->bm, co, NULL, BM_CREATE_NOP); - } - - /* need to rebuild entirely because array size changes */ - BM_mesh_elem_table_init(em->bm, BM_VERT); - - /* create faces */ - for (j = 0; j < trinum; j++) { - unsigned char *tri = &tris[4 * (tribase + j)]; - BMFace *newFace; - int *polygonIdx; - - for (k = 0; k < 3; k++) { - if (tri[k] < nv) - face[k] = p[tri[k]]; /* shared vertex */ - else - face[k] = uniquevbase + tri[k] - nv; /* unique vertex */ - } - newFace = BM_face_create_quad_tri(em->bm, - BM_vert_at_index(em->bm, face[0]), - BM_vert_at_index(em->bm, face[2]), - BM_vert_at_index(em->bm, face[1]), NULL, - NULL, BM_CREATE_NOP); - - /* set navigation polygon idx to the custom layer */ - polygonIdx = (int *)CustomData_bmesh_get(&em->bm->pdata, newFace->head.data, CD_RECAST); - *polygonIdx = i + 1; /* add 1 to avoid zero idx */ - } - } - - recast_destroyPolyMesh(pmesh); - recast_destroyPolyMeshDetail(dmesh); - - DEG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - - - ED_object_editmode_exit(C, EM_FREEDATA); - WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); - - if (createob) { - obedit->gameflag &= ~OB_COLLISION; - obedit->gameflag |= OB_NAVMESH; - obedit->body_type = OB_BODY_TYPE_NAVMESH; - } - - BKE_mesh_ensure_navmesh(obedit->data); - - return obedit; -} - -static int navmesh_create_exec(bContext *C, wmOperator *op) -{ - Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - LinkNode *obs = NULL; - Base *navmeshBase = NULL; - - CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) - { - if (base->object->type == OB_MESH) { - if (base->object->body_type == OB_BODY_TYPE_NAVMESH) { - if (!navmeshBase || base == view_layer->basact) { - navmeshBase = base; - } - } - else { - BLI_linklist_prepend(&obs, base->object); - } - } - } - CTX_DATA_END; - - if (obs) { - struct recast_polyMesh *pmesh = NULL; - struct recast_polyMeshDetail *dmesh = NULL; - bool ok; - unsigned int lay = 0; - - int nverts = 0, ntris = 0; - int *tris = NULL; - float *verts = NULL; - - createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris, &lay); - BLI_linklist_free(obs, NULL); - if ((ok = buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh, op->reports))) { - createRepresentation(C, pmesh, dmesh, navmeshBase, lay); - } - - MEM_freeN(verts); - MEM_freeN(tris); - - return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED; - } - else { - BKE_report(op->reports, RPT_ERROR, "No mesh objects found"); - - return OPERATOR_CANCELLED; - } -} - -void MESH_OT_navmesh_make(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Create Navigation Mesh"; - ot->description = "Create navigation mesh for selected objects"; - ot->idname = "MESH_OT_navmesh_make"; - - /* api callbacks */ - ot->exec = navmesh_create_exec; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - -static int navmesh_face_copy_exec(bContext *C, wmOperator *op) -{ - Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = BKE_editmesh_from_object(obedit); - - /* do work here */ - BMFace *efa_act = BM_mesh_active_face_get(em->bm, false, false); - - if (efa_act) { - if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) { - BMFace *efa; - BMIter iter; - int targetPolyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, efa_act->head.data, CD_RECAST); - targetPolyIdx = targetPolyIdx >= 0 ? targetPolyIdx : -targetPolyIdx; - - if (targetPolyIdx > 0) { - /* set target poly idx to other selected faces */ - BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) { - int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_RECAST); - *recastDataBlock = targetPolyIdx; - } - } - } - else { - BKE_report(op->reports, RPT_ERROR, "Active face has no index set"); - } - } - } - - DEG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - - return OPERATOR_FINISHED; -} - -void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "NavMesh Copy Face Index"; - ot->description = "Copy the index from the active face"; - ot->idname = "MESH_OT_navmesh_face_copy"; - - /* api callbacks */ - ot->poll = ED_operator_editmesh; - ot->exec = navmesh_face_copy_exec; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - -static int compare(const void *a, const void *b) -{ - return (*(int *)a - *(int *)b); -} - -static int findFreeNavPolyIndex(BMEditMesh *em) -{ - /* construct vector of indices */ - int numfaces = em->bm->totface; - int *indices = MEM_callocN(sizeof(int) * numfaces, "findFreeNavPolyIndex(indices)"); - BMFace *ef; - BMIter iter; - int i, idx = em->bm->totface - 1, freeIdx = 1; - - /*XXX this originally went last to first, but that isn't possible anymore*/ - BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) { - int polyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST); - indices[idx] = polyIdx; - idx--; - } - - qsort(indices, numfaces, sizeof(int), compare); - - /* search first free index */ - freeIdx = 1; - for (i = 0; i < numfaces; i++) { - if (indices[i] == freeIdx) - freeIdx++; - else if (indices[i] > freeIdx) - break; - } - - MEM_freeN(indices); - - return freeIdx; -} - -static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = BKE_editmesh_from_object(obedit); - BMFace *ef; - BMIter iter; - - if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) { - int targetPolyIdx = findFreeNavPolyIndex(em); - - if (targetPolyIdx > 0) { - /* set target poly idx to selected faces */ - /*XXX this originally went last to first, but that isn't possible anymore*/ - - BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) { - if (BM_elem_flag_test(ef, BM_ELEM_SELECT)) { - int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST); - *recastDataBlock = targetPolyIdx; - } - } - } - } - - DEG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - - return OPERATOR_FINISHED; -} - -void MESH_OT_navmesh_face_add(struct wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "NavMesh New Face Index"; - ot->description = "Add a new index and assign it to selected faces"; - ot->idname = "MESH_OT_navmesh_face_add"; - - /* api callbacks */ - ot->poll = ED_operator_editmesh; - ot->exec = navmesh_face_add_exec; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - -static int navmesh_obmode_data_poll(bContext *C) -{ - Object *ob = ED_object_active_context(C); - if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) { - Mesh *me = ob->data; - return CustomData_has_layer(&me->pdata, CD_RECAST); - } - return false; -} - -static int navmesh_obmode_poll(bContext *C) -{ - Object *ob = ED_object_active_context(C); - if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) { - return true; - } - return false; -} - -static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Object *ob = ED_object_active_context(C); - Mesh *me = ob->data; - - CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly); - - BKE_mesh_ensure_navmesh(me); - - DEG_id_tag_update(&me->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id); - - return OPERATOR_FINISHED; -} - -void MESH_OT_navmesh_reset(struct wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "NavMesh Reset Index Values"; - ot->description = "Assign a new index to every face"; - ot->idname = "MESH_OT_navmesh_reset"; - - /* api callbacks */ - ot->poll = navmesh_obmode_poll; - ot->exec = navmesh_reset_exec; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - -static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Object *ob = ED_object_active_context(C); - Mesh *me = ob->data; - - CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly); - - DEG_id_tag_update(&me->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id); - - return OPERATOR_FINISHED; -} - -void MESH_OT_navmesh_clear(struct wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "NavMesh Clear Data"; - ot->description = "Remove navmesh data from this mesh"; - ot->idname = "MESH_OT_navmesh_clear"; - - /* api callbacks */ - ot->poll = navmesh_obmode_data_poll; - ot->exec = navmesh_clear_exec; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index b9920f9deca..a2c996c7f42 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -197,14 +197,6 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_bisect); WM_operatortype_append(MESH_OT_symmetrize); WM_operatortype_append(MESH_OT_symmetry_snap); - -#ifdef WITH_GAMEENGINE - WM_operatortype_append(MESH_OT_navmesh_make); - WM_operatortype_append(MESH_OT_navmesh_face_copy); - WM_operatortype_append(MESH_OT_navmesh_face_add); - WM_operatortype_append(MESH_OT_navmesh_reset); - WM_operatortype_append(MESH_OT_navmesh_clear); -#endif } #if 0 /* UNUSED, remove? */ diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 646b8137b2d..e25b04668bc 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -50,7 +50,6 @@ set(SRC object_facemap_ops.c object_group.c object_hook.c - object_lod.c object_modes.c object_modifier.c object_ops.c @@ -72,10 +71,6 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -if(WITH_GAMEENGINE) - add_definitions(-DWITH_GAMEENGINE) -endif() - if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 4abd80a18e8..6f9f18d301e 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -48,7 +48,6 @@ #include "DNA_lightprobe_types.h" #include "DNA_scene_types.h" #include "DNA_vfont_types.h" -#include "DNA_actuator_types.h" #include "DNA_gpencil_types.h" #include "BLI_utildefines.h" @@ -88,7 +87,6 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_report.h" -#include "BKE_sca.h" #include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_speaker.h" @@ -440,12 +438,6 @@ Object *ED_object_add_type( /* more editor stuff */ ED_object_base_init_transform(C, view_layer->basact, loc, rot); - /* Ignore collisions by default for non-mesh objects */ - if (type != OB_MESH) { - ob->body_type = OB_BODY_TYPE_NO_COLLISION; - ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_OCCLUDER | OB_DYNAMIC | OB_NAVMESH); /* copied from rna_object.c */ - } - /* TODO(sergey): This is weird to manually tag objects for update, better to * use DEG_id_tag_update here perhaps. */ @@ -1347,8 +1339,6 @@ static void copy_object_set_idnew(bContext *C) } CTX_DATA_END; - set_sca_new_poins(); - BKE_main_id_clear_newpoins(bmain); } @@ -1502,7 +1492,6 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, /* Remap new object to itself, and clear again newid pointer of orig object. */ BKE_libblock_relink_to_newid(&ob_dst->id); - set_sca_new_poins_ob(ob_dst); DEG_id_tag_update(&ob_dst->id, OB_RECALC_DATA); @@ -1659,10 +1648,6 @@ static void curvetomesh(Depsgraph *depsgraph, Scene *scene, Object *ob) if (ob->type == OB_MESH) { BKE_object_free_modifiers(ob, 0); - - /* Game engine defaults for mesh objects */ - ob->body_type = OB_BODY_TYPE_STATIC; - ob->gameflag = OB_PROP | OB_COLLISION; } } @@ -2277,25 +2262,10 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer } if (dupflag & USER_DUP_ACT) { - bActuator *act; - BKE_animdata_copy_id_action((ID *)obn->data, true); if (key) { BKE_animdata_copy_id_action((ID *)key, true); } - - /* Update the duplicated action in the action actuators */ - /* XXX TODO this code is all wrong! actact->act is user-refcounted (see readfile.c), - * and what about other ID pointers of other BGE logic bricks, - * and since this is object-level, why is it only ran if obdata was duplicated??? -mont29 */ - for (act = obn->actuators.first; act; act = act->next) { - if (act->type == ACT_ACTION) { - bActionActuator *actact = (bActionActuator *) act->data; - if (ob->adt && actact->act == ob->adt->action) { - actact->act = obn->adt->action; - } - } - } } if (dupflag & USER_DUP_MAT) { @@ -2331,8 +2301,6 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, ViewLayer *view_layer, Base *basen; Object *ob; - clear_sca_new_poins(); /* BGE logic */ - basen = object_add_duplicate_internal(bmain, scene, view_layer, base->object, dupflag); if (basen == NULL) { return NULL; @@ -2342,7 +2310,6 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, ViewLayer *view_layer, /* link own references to the newly duplicated data [#26816] */ BKE_libblock_relink_to_newid(&ob->id); - set_sca_new_poins_ob(ob); /* DAG_relations_tag_update(bmain); */ /* caller must do */ @@ -2364,8 +2331,6 @@ static int duplicate_exec(bContext *C, wmOperator *op) const bool linked = RNA_boolean_get(op->ptr, "linked"); int dupflag = (linked) ? 0 : U.dupflag; - clear_sca_new_poins(); /* BGE logic */ - CTX_DATA_BEGIN (C, Base *, base, selected_bases) { Base *basen = object_add_duplicate_internal(bmain, scene, view_layer, base->object, dupflag); @@ -2449,8 +2414,6 @@ static int add_named_exec(bContext *C, wmOperator *op) } /* prepare dupli */ - clear_sca_new_poins(); /* BGE logic */ - basen = object_add_duplicate_internal(bmain, scene, view_layer, ob, dupflag); if (basen == NULL) { diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index ca742222d81..95778b73e55 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -1615,11 +1615,6 @@ static bool get_new_constraint_target(bContext *C, int con_type, Object **tar_ob only_ob = true; add = false; break; - - /* object only - add here is ok? */ - case CONSTRAINT_TYPE_RIGIDBODYJOINT: - only_ob = true; - break; } /* if the active Object is Armature, and we can search for bones, do so... */ @@ -1748,10 +1743,6 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase if (type == CONSTRAINT_TYPE_NULL) { return OPERATOR_CANCELLED; } - if ((type == CONSTRAINT_TYPE_RIGIDBODYJOINT) && (list != &ob->constraints)) { - BKE_report(op->reports, RPT_ERROR, "Rigid Body Joint constraint can only be added to objects"); - return OPERATOR_CANCELLED; - } if ((type == CONSTRAINT_TYPE_KINEMATIC) && ((!pchan) || (list != &pchan->constraints))) { BKE_report(op->reports, RPT_ERROR, "IK constraint can only be added to bones"); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index e884989b6b5..5565565c679 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -51,7 +51,6 @@ #include "DNA_group_types.h" #include "DNA_material_types.h" #include "DNA_meta_types.h" -#include "DNA_property_types.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" #include "DNA_object_force_types.h" @@ -80,8 +79,6 @@ #include "BKE_object.h" #include "BKE_paint.h" #include "BKE_pointcache.h" -#include "BKE_property.h" -#include "BKE_sca.h" #include "BKE_softbody.h" #include "BKE_modifier.h" #include "BKE_editlattice.h" @@ -613,102 +610,6 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -static void copymenu_properties(ViewLayer *view_layer, Object *ob) -{ -//XXX no longer used - to be removed - replaced by game_properties_copy_exec - bProperty *prop; - Base *base; - int nr, tot = 0; - char *str; - - prop = ob->prop.first; - while (prop) { - tot++; - prop = prop->next; - } - - str = MEM_callocN(50 + 33 * tot, "copymenu prop"); - - if (tot) - strcpy(str, "Copy Property %t|Replace All|Merge All|%l"); - else - strcpy(str, "Copy Property %t|Clear All (no properties on active)"); - - tot = 0; - prop = ob->prop.first; - while (prop) { - tot++; - strcat(str, "|"); - strcat(str, prop->name); - prop = prop->next; - } - - nr = pupmenu(str); - - if (nr == 1 || nr == 2) { - for (base = FIRSTBASE(view_layer); base; base = base->next) { - if ((base != BASACT(view_layer)) && (TESTBASELIB(base))) { - if (nr == 1) { /* replace */ - BKE_bproperty_copy_list(&base->object->prop, &ob->prop); - } - else { - for (prop = ob->prop.first; prop; prop = prop->next) { - BKE_bproperty_object_set(base->object, prop); - } - } - } - } - } - else if (nr > 0) { - prop = BLI_findlink(&ob->prop, nr - 4); /* account for first 3 menu items & menu index starting at 1*/ - - if (prop) { - for (base = FIRSTBASE(view_layer); base; base = base->next) { - if ((base != BASACT(view_layer)) && (TESTBASELIB(base))) { - BKE_bproperty_object_set(base->object, prop); - } - } - } - } - MEM_freeN(str); - -} - -static void copymenu_logicbricks(ViewLayer *view_layer, Object *ob) -{ -//XXX no longer used - to be removed - replaced by logicbricks_copy_exec - Base *base; - - for (base = FIRSTBASE(view_layer); base; base = base->next) { - if (base->object != ob) { - if (TESTBASELIB(base)) { - - /* first: free all logic */ - free_sensors(&base->object->sensors); - unlink_controllers(&base->object->controllers); - free_controllers(&base->object->controllers); - unlink_actuators(&base->object->actuators); - free_actuators(&base->object->actuators); - - /* now copy it, this also works without logicbricks! */ - clear_sca_new_poins_ob(ob); - copy_sensors(&base->object->sensors, &ob->sensors, 0); - copy_controllers(&base->object->controllers, &ob->controllers, 0); - copy_actuators(&base->object->actuators, &ob->actuators, 0); - set_sca_new_poins_ob(base->object); - - /* some menu settings */ - base->object->scavisflag = ob->scavisflag; - base->object->scaflag = ob->scaflag; - - /* set the initial state */ - base->object->state = ob->state; - base->object->init_state = ob->init_state; - } - } - } -} - /* both pointers should exist */ static void copy_texture_space(Object *to, Object *ob) { @@ -776,15 +677,8 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev /* obedit_copymenu(); */ return; } - if (event == 9) { - copymenu_properties(view_layer, ob); - return; - } - else if (event == 10) { - copymenu_logicbricks(view_layer, ob); - return; - } - else if (event == 24) { + + if (event == 24) { /* moved to BKE_object_link_modifiers */ /* copymenu_modifiers(bmain, scene, v3d, ob); */ return; @@ -832,30 +726,6 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev if (ob->dup_group) id_us_plus(&ob->dup_group->id); } - else if (event == 7) { /* mass */ - base->object->mass = ob->mass; - } - else if (event == 8) { /* damping */ - base->object->damping = ob->damping; - base->object->rdamping = ob->rdamping; - } - else if (event == 11) { /* all physical attributes */ - base->object->gameflag = ob->gameflag; - base->object->inertia = ob->inertia; - base->object->formfactor = ob->formfactor; - base->object->damping = ob->damping; - base->object->rdamping = ob->rdamping; - base->object->min_vel = ob->min_vel; - base->object->max_vel = ob->max_vel; - base->object->min_angvel = ob->min_angvel; - base->object->max_angvel = ob->max_angvel; - if (ob->gameflag & OB_BOUNDS) { - base->object->collision_boundtype = ob->collision_boundtype; - } - base->object->margin = ob->margin; - base->object->bsoft = copy_bulletsoftbody(ob->bsoft, 0); - - } else if (event == 17) { /* tex space */ copy_texture_space(base->object, ob); } @@ -1641,393 +1511,6 @@ void OBJECT_OT_mode_set(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -/************************ Game Properties ***********************/ - -static int game_property_new_exec(bContext *C, wmOperator *op) -{ - Object *ob = CTX_data_active_object(C); - bProperty *prop; - char name[MAX_NAME]; - int type = RNA_enum_get(op->ptr, "type"); - - prop = BKE_bproperty_new(type); - BLI_addtail(&ob->prop, prop); - - RNA_string_get(op->ptr, "name", name); - if (name[0] != '\0') { - BLI_strncpy(prop->name, name, sizeof(prop->name)); - } - - BLI_uniquename(&ob->prop, prop, DATA_("Property"), '.', offsetof(bProperty, name), sizeof(prop->name)); - - WM_event_add_notifier(C, NC_LOGIC, NULL); - return OPERATOR_FINISHED; -} - - -void OBJECT_OT_game_property_new(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "New Game Property"; - ot->description = "Create a new property available to the game engine"; - ot->idname = "OBJECT_OT_game_property_new"; - - /* api callbacks */ - ot->exec = game_property_new_exec; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - RNA_def_enum(ot->srna, "type", rna_enum_gameproperty_type_items, GPROP_FLOAT, "Type", "Type of game property to add"); - RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the game property to add"); -} - -static int game_property_remove_exec(bContext *C, wmOperator *op) -{ - Object *ob = CTX_data_active_object(C); - bProperty *prop; - int index = RNA_int_get(op->ptr, "index"); - - if (!ob) - return OPERATOR_CANCELLED; - - prop = BLI_findlink(&ob->prop, index); - - if (prop) { - BLI_remlink(&ob->prop, prop); - BKE_bproperty_free(prop); - - WM_event_add_notifier(C, NC_LOGIC, NULL); - return OPERATOR_FINISHED; - } - else { - return OPERATOR_CANCELLED; - } -} - -void OBJECT_OT_game_property_remove(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Remove Game Property"; - ot->description = "Remove game property"; - ot->idname = "OBJECT_OT_game_property_remove"; - - /* api callbacks */ - ot->exec = game_property_remove_exec; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to remove ", 0, INT_MAX); -} - -#define GAME_PROPERTY_MOVE_UP 1 -#define GAME_PROPERTY_MOVE_DOWN -1 - -static int game_property_move(bContext *C, wmOperator *op) -{ - Object *ob = CTX_data_active_object(C); - bProperty *prop; - bProperty *otherprop = NULL; - const int index = RNA_int_get(op->ptr, "index"); - const int dir = RNA_enum_get(op->ptr, "direction"); - - if (ob == NULL) - return OPERATOR_CANCELLED; - - prop = BLI_findlink(&ob->prop, index); - /* invalid index */ - if (prop == NULL) - return OPERATOR_CANCELLED; - - if (dir == GAME_PROPERTY_MOVE_UP) { - otherprop = prop->prev; - } - else if (dir == GAME_PROPERTY_MOVE_DOWN) { - otherprop = prop->next; - } - else { - BLI_assert(0); - } - - if (prop && otherprop) { - BLI_listbase_swaplinks(&ob->prop, prop, otherprop); - - WM_event_add_notifier(C, NC_LOGIC, NULL); - return OPERATOR_FINISHED; - } - else { - return OPERATOR_CANCELLED; - } -} - -void OBJECT_OT_game_property_move(wmOperatorType *ot) -{ - static const EnumPropertyItem direction_property_move[] = { - {GAME_PROPERTY_MOVE_UP, "UP", 0, "Up", ""}, - {GAME_PROPERTY_MOVE_DOWN, "DOWN", 0, "Down", ""}, - {0, NULL, 0, NULL, NULL} - }; - PropertyRNA *prop; - - /* identifiers */ - ot->name = "Move Game Property"; - ot->description = "Move game property"; - ot->idname = "OBJECT_OT_game_property_move"; - - /* api callbacks */ - ot->exec = game_property_move; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ - prop = RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to move", 0, INT_MAX); - RNA_def_property_flag(prop, PROP_HIDDEN); - RNA_def_enum(ot->srna, "direction", direction_property_move, 0, "Direction", - "Direction for moving the property"); -} - -#undef GAME_PROPERTY_MOVE_UP -#undef GAME_PROPERTY_MOVE_DOWN - -#define COPY_PROPERTIES_REPLACE 1 -#define COPY_PROPERTIES_MERGE 2 -#define COPY_PROPERTIES_COPY 3 - -static const EnumPropertyItem game_properties_copy_operations[] = { - {COPY_PROPERTIES_REPLACE, "REPLACE", 0, "Replace Properties", ""}, - {COPY_PROPERTIES_MERGE, "MERGE", 0, "Merge Properties", ""}, - {COPY_PROPERTIES_COPY, "COPY", 0, "Copy a Property", ""}, - {0, NULL, 0, NULL, NULL} -}; - -static const EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) -{ - Object *ob = ED_object_active_context(C); - EnumPropertyItem tmp = {0, "", 0, "", ""}; - EnumPropertyItem *item = NULL; - bProperty *prop; - int a, totitem = 0; - - if (!ob) - return DummyRNA_NULL_items; - - for (a = 1, prop = ob->prop.first; prop; prop = prop->next, a++) { - tmp.value = a; - tmp.identifier = prop->name; - tmp.name = prop->name; - RNA_enum_item_add(&item, &totitem, &tmp); - } - - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; -} - -static int game_property_copy_exec(bContext *C, wmOperator *op) -{ - Object *ob = ED_object_active_context(C); - bProperty *prop; - int type = RNA_enum_get(op->ptr, "operation"); - int propid = RNA_enum_get(op->ptr, "property"); - - if (propid > 0) { /* copy */ - prop = BLI_findlink(&ob->prop, propid - 1); - - if (prop) { - CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) - { - if (ob != ob_iter) - BKE_bproperty_object_set(ob_iter, prop); - } CTX_DATA_END; - } - } - - else { - CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) - { - if (ob != ob_iter) { - if (type == COPY_PROPERTIES_REPLACE) { - BKE_bproperty_copy_list(&ob_iter->prop, &ob->prop); - } - else { - /* merge - the default when calling with no argument */ - for (prop = ob->prop.first; prop; prop = prop->next) { - BKE_bproperty_object_set(ob_iter, prop); - } - } - } - } - CTX_DATA_END; - } - - return OPERATOR_FINISHED; -} - -void OBJECT_OT_game_property_copy(wmOperatorType *ot) -{ - PropertyRNA *prop; - /* identifiers */ - ot->name = "Copy Game Property"; - ot->idname = "OBJECT_OT_game_property_copy"; - ot->description = "Copy/merge/replace a game property from active object to all selected objects"; - - /* api callbacks */ - ot->exec = game_property_copy_exec; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - RNA_def_enum(ot->srna, "operation", game_properties_copy_operations, 3, "Operation", ""); - prop = RNA_def_enum(ot->srna, "property", DummyRNA_NULL_items, 0, "Property", "Properties to copy"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_ENUM_NO_TRANSLATE); - RNA_def_enum_funcs(prop, gameprops_itemf); - ot->prop = prop; -} - -static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op)) -{ - CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) - { - BKE_bproperty_free_list(&ob_iter->prop); - } - CTX_DATA_END; - - WM_event_add_notifier(C, NC_LOGIC, NULL); - return OPERATOR_FINISHED; -} -void OBJECT_OT_game_property_clear(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Clear Game Properties"; - ot->idname = "OBJECT_OT_game_property_clear"; - ot->description = "Remove all game properties from all selected objects"; - - /* api callbacks */ - ot->exec = game_property_clear_exec; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - -/************************ Copy Logic Bricks ***********************/ - -static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Object *ob = ED_object_active_context(C); - - CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) - { - if (ob != ob_iter) { - /* first: free all logic */ - free_sensors(&ob_iter->sensors); - unlink_controllers(&ob_iter->controllers); - free_controllers(&ob_iter->controllers); - unlink_actuators(&ob_iter->actuators); - free_actuators(&ob_iter->actuators); - - /* now copy it, this also works without logicbricks! */ - clear_sca_new_poins_ob(ob); - copy_sensors(&ob_iter->sensors, &ob->sensors, 0); - copy_controllers(&ob_iter->controllers, &ob->controllers, 0); - copy_actuators(&ob_iter->actuators, &ob->actuators, 0); - set_sca_new_poins_ob(ob_iter); - - /* some menu settings */ - ob_iter->scavisflag = ob->scavisflag; - ob_iter->scaflag = ob->scaflag; - - /* set the initial state */ - ob_iter->state = ob->state; - ob_iter->init_state = ob->init_state; - - if (ob_iter->totcol == ob->totcol) { - ob_iter->actcol = ob->actcol; - WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob_iter); - } - } - } - CTX_DATA_END; - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Copy Logic Bricks to Selected"; - ot->description = "Copy logic bricks to other selected objects"; - ot->idname = "OBJECT_OT_logic_bricks_copy"; - - /* api callbacks */ - ot->exec = logicbricks_copy_exec; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - -static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Object *ob = ED_object_active_context(C); - - CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) - { - if (ob != ob_iter) { - ob_iter->gameflag = ob->gameflag; - ob_iter->gameflag2 = ob->gameflag2; - ob_iter->inertia = ob->inertia; - ob_iter->formfactor = ob->formfactor; - ob_iter->damping = ob->damping; - ob_iter->rdamping = ob->rdamping; - ob_iter->min_vel = ob->min_vel; - ob_iter->max_vel = ob->max_vel; - ob_iter->min_angvel = ob->min_angvel; - ob_iter->max_angvel = ob->max_angvel; - ob_iter->obstacleRad = ob->obstacleRad; - ob_iter->mass = ob->mass; - copy_v3_v3(ob_iter->anisotropicFriction, ob->anisotropicFriction); - ob_iter->collision_boundtype = ob->collision_boundtype; - ob_iter->margin = ob->margin; - ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft, 0); - if (ob->restrictflag & OB_RESTRICT_RENDER) - ob_iter->restrictflag |= OB_RESTRICT_RENDER; - else - ob_iter->restrictflag &= ~OB_RESTRICT_RENDER; - - ob_iter->col_group = ob->col_group; - ob_iter->col_mask = ob->col_mask; - } - } - CTX_DATA_END; - - return OPERATOR_FINISHED; -} - -void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Copy Game Physics Properties to Selected"; - ot->description = "Copy game physics properties to other selected objects"; - ot->idname = "OBJECT_OT_game_physics_copy"; - - /* api callbacks */ - ot->exec = game_physics_copy_exec; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - bool ED_object_editmode_calc_active_center(Object *obedit, const bool select_only, float r_center[3]) { switch (obedit->type) { diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 75117ccdce3..5025ca5bb96 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -87,14 +87,6 @@ void OBJECT_OT_paths_update(struct wmOperatorType *ot); void OBJECT_OT_paths_clear(struct wmOperatorType *ot); void OBJECT_OT_forcefield_toggle(struct wmOperatorType *ot); -void OBJECT_OT_game_property_new(struct wmOperatorType *ot); -void OBJECT_OT_game_property_remove(struct wmOperatorType *ot); -void OBJECT_OT_game_property_copy(struct wmOperatorType *ot); -void OBJECT_OT_game_property_clear(struct wmOperatorType *ot); -void OBJECT_OT_game_property_move(struct wmOperatorType *ot); -void OBJECT_OT_logic_bricks_copy(struct wmOperatorType *ot); -void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot); - void OBJECT_OT_move_to_collection(struct wmOperatorType *ot); /* object_select.c */ diff --git a/source/blender/editors/object/object_lod.c b/source/blender/editors/object/object_lod.c deleted file mode 100644 index ced306178b8..00000000000 --- a/source/blender/editors/object/object_lod.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) Blender Foundation - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/editors/object/object_lod.c - * \ingroup edobj - */ - -#include "DNA_object_types.h" - -#include "BKE_context.h" - -#include "WM_api.h" -#include "WM_types.h" - -#include "RNA_access.h" -#include "RNA_define.h" - -#include "ED_screen.h" -#include "ED_object.h" - -#ifdef WITH_GAMEENGINE -# include "BKE_object.h" - -# include "RNA_enum_types.h" -#endif - -#include "object_intern.h" - -static int object_lod_add_exec(bContext *C, wmOperator *UNUSED(op)) -{ - Object *ob = ED_object_context(C); - -#ifdef WITH_GAMEENGINE - BKE_object_lod_add(ob); -#else - (void)ob; -#endif - - return OPERATOR_FINISHED; -} - -void OBJECT_OT_lod_add(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Add Level of Detail"; - ot->description = "Add a level of detail to this object"; - ot->idname = "OBJECT_OT_lod_add"; - - /* api callbacks */ - ot->exec = object_lod_add_exec; - ot->poll = ED_operator_object_active; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - -static int object_lod_remove_exec(bContext *C, wmOperator *op) -{ - Object *ob = ED_object_context(C); - int index = RNA_int_get(op->ptr, "index"); - -#ifdef WITH_GAMEENGINE - if (!BKE_object_lod_remove(ob, index)) - return OPERATOR_CANCELLED; -#else - (void)ob; - (void)index; -#endif - - WM_event_add_notifier(C, NC_OBJECT | ND_LOD, CTX_wm_view3d(C)); - return OPERATOR_FINISHED; -} - -void OBJECT_OT_lod_remove(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Remove Level of Detail"; - ot->description = "Remove a level of detail from this object"; - ot->idname = "OBJECT_OT_lod_remove"; - - /* api callbacks */ - ot->exec = object_lod_remove_exec; - ot->poll = ED_operator_object_active; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ - ot->prop = RNA_def_int(ot->srna, "index", 1, 1, INT_MAX, "Index", "", 1, INT_MAX); -} diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 66dc17fe77d..c4c86b3932d 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -212,14 +212,6 @@ void ED_operatortypes_object(void) WM_operatortype_append(TRANSFORM_OT_vertex_warp); - WM_operatortype_append(OBJECT_OT_game_property_new); - WM_operatortype_append(OBJECT_OT_game_property_remove); - WM_operatortype_append(OBJECT_OT_game_property_copy); - WM_operatortype_append(OBJECT_OT_game_property_clear); - WM_operatortype_append(OBJECT_OT_game_property_move); - WM_operatortype_append(OBJECT_OT_logic_bricks_copy); - WM_operatortype_append(OBJECT_OT_game_physics_copy); - WM_operatortype_append(OBJECT_OT_move_to_collection); WM_operatortype_append(OBJECT_OT_shape_key_add); @@ -249,9 +241,6 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_unlink_data); WM_operatortype_append(OBJECT_OT_laplaciandeform_bind); - WM_operatortype_append(OBJECT_OT_lod_add); - WM_operatortype_append(OBJECT_OT_lod_remove); - WM_operatortype_append(TRANSFORM_OT_vertex_random); WM_operatortype_append(OBJECT_OT_data_transfer); @@ -327,9 +316,6 @@ void ED_keymap_object(wmKeyConfig *keyconf) ED_keymap_proportional_cycle(keyconf, keymap); ED_keymap_proportional_obmode(keyconf, keymap); - /* game-engine only, leave free for users to define */ - WM_keymap_add_item(keymap, "VIEW3D_OT_game_start", PKEY, KM_PRESS, 0, 0); - kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", AKEY, KM_PRESS, 0, 0); RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 417c32a71e9..0e0f2784936 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -89,7 +89,6 @@ #include "BKE_node.h" #include "BKE_object.h" #include "BKE_report.h" -#include "BKE_sca.h" #include "BKE_scene.h" #include "BKE_speaker.h" #include "BKE_texture.h" @@ -1681,8 +1680,6 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in { Group *group, *groupn; - clear_sca_new_poins(); /* BGE logic */ - /* duplicate all the objects of the scene */ SceneCollection *msc = BKE_collection_master(&scene->id); single_object_users_scene_collection(bmain, scene, msc, flag, copy_groups); @@ -1728,8 +1725,6 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in /* object and group pointers */ libblock_relink_scene_collection(msc); - - set_sca_new_poins(); } /* not an especially efficient function, only added so the single user diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index cd1300dd52e..d958381efe7 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -37,7 +37,6 @@ #include "DNA_group_types.h" #include "DNA_material_types.h" #include "DNA_modifier_types.h" -#include "DNA_property_types.h" #include "DNA_scene_types.h" #include "DNA_armature_types.h" #include "DNA_lamp_types.h" @@ -59,7 +58,6 @@ #include "BKE_object.h" #include "BKE_particle.h" #include "BKE_paint.h" -#include "BKE_property.h" #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_workspace.h" @@ -504,9 +502,8 @@ enum { OBJECT_GRPSEL_HOOK = 7, OBJECT_GRPSEL_PASS = 8, OBJECT_GRPSEL_COLOR = 9, - OBJECT_GRPSEL_PROPERTIES = 10, - OBJECT_GRPSEL_KEYINGSET = 11, - OBJECT_GRPSEL_LAMP_TYPE = 12, + OBJECT_GRPSEL_KEYINGSET = 10, + OBJECT_GRPSEL_LAMP_TYPE = 11, }; static const EnumPropertyItem prop_select_grouped_types[] = { @@ -520,7 +517,6 @@ static const EnumPropertyItem prop_select_grouped_types[] = { {OBJECT_GRPSEL_HOOK, "HOOK", 0, "Hook", ""}, {OBJECT_GRPSEL_PASS, "PASS", 0, "Pass", "Render pass Index"}, {OBJECT_GRPSEL_COLOR, "COLOR", 0, "Color", "Object Color"}, - {OBJECT_GRPSEL_PROPERTIES, "PROPERTIES", 0, "Properties", "Game Properties"}, {OBJECT_GRPSEL_KEYINGSET, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"}, {OBJECT_GRPSEL_LAMP_TYPE, "LAMP_TYPE", 0, "Lamp Type", "Matching lamp types"}, {0, NULL, 0, NULL, NULL} @@ -773,33 +769,6 @@ static bool select_grouped_color(bContext *C, Object *ob) return changed; } -static bool objects_share_gameprop(Object *a, Object *b) -{ - bProperty *prop; - - for (prop = a->prop.first; prop; prop = prop->next) { - if (BKE_bproperty_object_get(b, prop->name)) { - return 1; - } - } - return 0; -} - -static bool select_grouped_gameprops(bContext *C, Object *ob) -{ - bool changed = false; - - CTX_DATA_BEGIN (C, Base *, base, selectable_bases) - { - if (((base->flag & BASE_SELECTED) == 0) && (objects_share_gameprop(base->object, ob))) { - ED_object_base_select(base, BA_SELECT); - changed = true; - } - } - CTX_DATA_END; - return changed; -} - static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList *reports) { KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C)); @@ -907,9 +876,6 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op) case OBJECT_GRPSEL_COLOR: changed |= select_grouped_color(C, ob); break; - case OBJECT_GRPSEL_PROPERTIES: - changed |= select_grouped_gameprops(C, ob); - break; case OBJECT_GRPSEL_KEYINGSET: changed |= select_grouped_keyingset(C, ob, op->reports); break; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index c944d94fac5..25d5fbbdc4c 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -288,11 +288,6 @@ int ED_operator_nla_active(bContext *C) return ed_spacetype_test(C, SPACE_NLA); } -int ED_operator_logic_active(bContext *C) -{ - return ed_spacetype_test(C, SPACE_LOGIC); -} - int ED_operator_info_active(bContext *C) { return ed_spacetype_test(C, SPACE_INFO); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index ef125da46a7..4eea4fed9b6 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5693,7 +5693,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); Material *ma; - bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene); + bool is_bi = BKE_scene_uses_blender_internal(scene); Image *ima = NULL; if (!ob) @@ -5846,7 +5846,7 @@ static int texture_paint_delete_texture_paint_slot_exec(bContext *C, wmOperator Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); Material *ma; - bool is_bi = BKE_scene_uses_blender_internal(scene) || BKE_scene_uses_blender_game(scene); + bool is_bi = BKE_scene_uses_blender_internal(scene); TexPaintSlot *slot; /* not supported for node-based engines */ diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 82589857ba5..f8888ad9809 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -497,10 +497,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr if (ibuf->rect_float) { float rgba_f[4]; - if (U.gameflags & USER_DISABLE_MIPMAP) - nearest_interpolation_color_wrap(ibuf, NULL, rgba_f, u, v); - else - bilinear_interpolation_color_wrap(ibuf, NULL, rgba_f, u, v); + bilinear_interpolation_color_wrap(ibuf, NULL, rgba_f, u, v); straight_to_premul_v4(rgba_f); if (use_palette) { linearrgb_to_srgb_v3_v3(color->rgb, rgba_f); @@ -512,10 +509,7 @@ void paint_sample_color(bContext *C, ARegion *ar, int x, int y, bool texpaint_pr } else { unsigned char rgba[4]; - if (U.gameflags & USER_DISABLE_MIPMAP) - nearest_interpolation_color_wrap(ibuf, rgba, NULL, u, v); - else - bilinear_interpolation_color_wrap(ibuf, rgba, NULL, u, v); + bilinear_interpolation_color_wrap(ibuf, rgba, NULL, u, v); if (use_palette) { rgb_uchar_to_float(color->rgb, rgba); } diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 4455b117370..3f3cb8bce4b 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -95,7 +95,6 @@ void ED_spacetypes_init(void) ED_spacetype_script(); ED_spacetype_text(); ED_spacetype_sequencer(); - ED_spacetype_logic(); ED_spacetype_console(); ED_spacetype_userpref(); ED_spacetype_clip(); @@ -121,7 +120,6 @@ void ED_spacetypes_init(void) ED_operatortypes_metaball(); ED_operatortypes_sound(); ED_operatortypes_render(); - ED_operatortypes_logic(); ED_operatortypes_mask(); ED_operatortypes_io(); diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt deleted file mode 100644 index 349c003cf56..00000000000 --- a/source/blender/editors/space_logic/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -# ***** 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): Jacques Beaurain. -# -# ***** END GPL LICENSE BLOCK ***** - -set(INC - ../include - ../interface - ../../blenkernel - ../../blenlib - ../../blentranslation - ../../gpu - ../../makesdna - ../../makesrna - ../../windowmanager - ../../../../intern/guardedalloc - ../../../../intern/glew-mx -) - -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - -set(SRC - logic_buttons.c - logic_ops.c - logic_window.c - space_logic.c - - logic_intern.h -) - -if(WITH_GAMEENGINE) - add_definitions(-DWITH_GAMEENGINE) -endif() - -add_definitions(${GL_DEFINITIONS}) - -if(WITH_INTERNATIONAL) - add_definitions(-DWITH_INTERNATIONAL) -endif() - -blender_add_lib(bf_editor_space_logic "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c deleted file mode 100644 index 54e6e217b77..00000000000 --- a/source/blender/editors/space_logic/logic_buttons.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2009 by Blender Foundation - * All rights reserved. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/editors/space_logic/logic_buttons.c - * \ingroup splogic - */ - - -#include <string.h> -#include <stdio.h> - -#include "BLI_blenlib.h" -#include "BLI_math.h" -#include "BLI_utildefines.h" - -#include "BKE_context.h" - -#include "ED_screen.h" - -#include "RNA_access.h" -#include "RNA_define.h" - -#include "WM_api.h" -#include "WM_types.h" - -#include "UI_interface.h" -#include "UI_view2d.h" - -#include "interface_intern.h" -#include "logic_intern.h" - -static int logic_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) -{ - ScrArea *sa = CTX_wm_area(C); - ARegion *ar = logic_has_buttons_region(sa); - - if (ar) - ED_region_toggle_hidden(C, ar); - - return OPERATOR_FINISHED; -} - -void LOGIC_OT_properties(wmOperatorType *ot) -{ - ot->name = "Properties"; - ot->description = "Toggle the properties region visibility"; - ot->idname = "LOGIC_OT_properties"; - - ot->exec = logic_properties_toggle_exec; - ot->poll = ED_operator_logic_active; - - /* flags */ - ot->flag = 0; -} - -/* Remove Logic Bricks Connections */ -/* ********************** Cut Link operator ***************** */ - -#define LINK_RESOL 12 -static int cut_links_intersect(uiLinkLine *line, float mcoords[][2], int tot) -{ - float coord_array[LINK_RESOL+1][2]; - int i, b; - rcti rectlink; - - rectlink.xmin = (int)BLI_rctf_cent_x(&line->from->rect); - rectlink.ymin = (int)BLI_rctf_cent_y(&line->from->rect); - rectlink.xmax = (int)BLI_rctf_cent_x(&line->to->rect); - rectlink.ymax = (int)BLI_rctf_cent_y(&line->to->rect); - - if (ui_link_bezier_points(&rectlink, coord_array, LINK_RESOL)) { - for (i=0; i<tot-1; i++) - for (b=0; b<LINK_RESOL-1; b++) - if (isect_seg_seg_v2(mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1]) > 0) - return 1; - } - return 0; -} - -static int cut_links_exec(bContext *C, wmOperator *op) -{ - ARegion *ar = CTX_wm_region(C); - float mcoords[256][2]; - int i = 0; - - RNA_BEGIN (op->ptr, itemptr, "path") - { - float loc[2]; - - RNA_float_get_array(&itemptr, "loc", loc); - UI_view2d_region_to_view(&ar->v2d, - (int)loc[0], (int)loc[1], - &mcoords[i][0], &mcoords[i][1]); - i++; - if (i >= 256) break; - } - RNA_END; - - if (i>1) { - uiBlock *block; - uiLinkLine *line, *nline; - uiBut *but; - for (block = ar->uiblocks.first; block; block = block->next) { - but = block->buttons.first; - while (but) { - if (but->type==UI_BTYPE_LINK && but->link) { - for (line = but->link->lines.first; line; line = nline) { - nline = line->next; - - if (cut_links_intersect(line, mcoords, i)) { - ui_linkline_remove(line, but); - } - } - } - but = but->next; - } - } - return OPERATOR_FINISHED; - } - return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH; -} - -void LOGIC_OT_links_cut(wmOperatorType *ot) -{ - ot->name = "Cut Links"; - ot->idname = "LOGIC_OT_links_cut"; - ot->description = "Remove logic brick connections"; - - ot->invoke = WM_gesture_lines_invoke; - ot->modal = WM_gesture_lines_modal; - ot->exec = cut_links_exec; - ot->cancel = WM_gesture_lines_cancel; - - ot->poll = ED_operator_logic_active; - - /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; - - /* properties */ - PropertyRNA *prop; - prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); - /* internal */ - RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX); -} - diff --git a/source/blender/editors/space_logic/logic_intern.h b/source/blender/editors/space_logic/logic_intern.h deleted file mode 100644 index 13146621d1b..00000000000 --- a/source/blender/editors/space_logic/logic_intern.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): Blender Foundation - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/editors/space_logic/logic_intern.h - * \ingroup splogic - */ - - -#ifndef __LOGIC_INTERN_H__ -#define __LOGIC_INTERN_H__ - -/* internal exports only */ -struct bContext; -struct ARegion; -struct ScrArea; -struct wmOperatorType; - -/* space_logic.c */ -struct ARegion *logic_has_buttons_region(struct ScrArea *sa); - -/* logic_ops.c */ - -/* logic_buttons.c */ -void LOGIC_OT_properties(struct wmOperatorType *ot); -void LOGIC_OT_links_cut(struct wmOperatorType *ot); - -/* logic_window.c */ -void logic_buttons(struct bContext *C, struct ARegion *ar); -void make_unique_prop_names(struct bContext *C, char *str); - -#endif /* __LOGIC_INTERN_H__ */ - diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c deleted file mode 100644 index 7b9a8634490..00000000000 --- a/source/blender/editors/space_logic/logic_ops.c +++ /dev/null @@ -1,753 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): Blender Foundation - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/editors/space_logic/logic_ops.c - * \ingroup splogic - */ - -#include <stddef.h> - -#include "DNA_object_types.h" -#include "DNA_sensor_types.h" -#include "DNA_controller_types.h" -#include "DNA_actuator_types.h" -#include "DNA_scene_types.h" - -#include "BLI_blenlib.h" -#include "BLI_string_utils.h" -#include "BLI_utildefines.h" - -#include "BLT_translation.h" - -#include "BKE_context.h" -#include "BKE_main.h" -#include "BKE_sca.h" - -#include "ED_logic.h" -#include "ED_object.h" -#include "ED_screen.h" - -#include "RNA_access.h" -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "WM_api.h" -#include "WM_types.h" - -#include "UI_view2d.h" - -#include "logic_intern.h" - -/* ************* Generic Operator Helpers ************* */ -static int edit_sensor_poll(bContext *C) -{ - PointerRNA ptr = CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor); - - if (ptr.data && ID_IS_LINKED(ptr.id.data)) return 0; - return 1; -} - -static int edit_controller_poll(bContext *C) -{ - PointerRNA ptr = CTX_data_pointer_get_type(C, "controller", &RNA_Controller); - - if (ptr.data && ID_IS_LINKED(ptr.id.data)) return 0; - return 1; -} - -static int edit_actuator_poll(bContext *C) -{ - PointerRNA ptr = CTX_data_pointer_get_type(C, "actuator", &RNA_Actuator); - - if (ptr.data && ID_IS_LINKED(ptr.id.data)) return 0; - return 1; -} - -static void edit_sensor_properties(wmOperatorType *ot) -{ - RNA_def_string(ot->srna, "sensor", NULL, MAX_NAME, "Sensor", "Name of the sensor to edit"); - RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the object the sensor belongs to"); -} - -static int edit_sensor_invoke_properties(bContext *C, wmOperator *op) -{ - PointerRNA ptr = CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor); - - if (RNA_struct_property_is_set(op->ptr, "sensor") && RNA_struct_property_is_set(op->ptr, "object") ) - return 1; - - if (ptr.data) { - bSensor *sens = ptr.data; - Object *ob = ptr.id.data; - - RNA_string_set(op->ptr, "sensor", sens->name); - RNA_string_set(op->ptr, "object", ob->id.name + 2); - return 1; - } - - return 0; -} - -static Object *edit_object_property_get(bContext *C, wmOperator *op) -{ - char ob_name[MAX_NAME]; - Object *ob; - - RNA_string_get(op->ptr, "object", ob_name); - - /* if ob_name is valid try to find the object with this name - * otherwise gets the active object */ - if (*ob_name) - ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2); - else - ob = ED_object_active_context(C); - - return ob; -} - -static bSensor *edit_sensor_property_get(bContext *C, wmOperator *op, Object **ob) -{ - char sensor_name[MAX_NAME]; - bSensor *sens; - - RNA_string_get(op->ptr, "sensor", sensor_name); - - *ob = edit_object_property_get(C, op); - if (!*ob) return NULL; - - sens = BLI_findstring(&((*ob)->sensors), sensor_name, offsetof(bSensor, name)); - return sens; -} - -static void edit_controller_properties(wmOperatorType *ot) -{ - RNA_def_string(ot->srna, "controller", NULL, MAX_NAME, "Controller", "Name of the controller to edit"); - RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the object the controller belongs to"); -} - -static int edit_controller_invoke_properties(bContext *C, wmOperator *op) -{ - PointerRNA ptr = CTX_data_pointer_get_type(C, "controller", &RNA_Controller); - - if (RNA_struct_property_is_set(op->ptr, "controller") && RNA_struct_property_is_set(op->ptr, "object") ) - return 1; - - if (ptr.data) { - bController *cont = ptr.data; - Object *ob = ptr.id.data; - - RNA_string_set(op->ptr, "controller", cont->name); - RNA_string_set(op->ptr, "object", ob->id.name + 2); - return 1; - } - - return 0; -} - -static bController *edit_controller_property_get(bContext *C, wmOperator *op, Object **ob) -{ - char controller_name[MAX_NAME]; - bController *cont; - - RNA_string_get(op->ptr, "controller", controller_name); - - *ob = edit_object_property_get(C, op); - if (!*ob) return NULL; - - cont = BLI_findstring(&((*ob)->controllers), controller_name, offsetof(bController, name)); - return cont; -} - -static void edit_actuator_properties(wmOperatorType *ot) -{ - RNA_def_string(ot->srna, "actuator", NULL, MAX_NAME, "Actuator", "Name of the actuator to edit"); - RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the object the actuator belongs to"); -} - -static int edit_actuator_invoke_properties(bContext *C, wmOperator *op) -{ - PointerRNA ptr = CTX_data_pointer_get_type(C, "actuator", &RNA_Actuator); - - if (RNA_struct_property_is_set(op->ptr, "actuator") && RNA_struct_property_is_set(op->ptr, "object") ) - return 1; - - if (ptr.data) { - bActuator *act = ptr.data; - Object *ob = ptr.id.data; - - RNA_string_set(op->ptr, "actuator", act->name); - RNA_string_set(op->ptr, "object", ob->id.name + 2); - return 1; - } - - return 0; -} - -static bActuator *edit_actuator_property_get(bContext *C, wmOperator *op, Object **ob) -{ - char actuator_name[MAX_NAME]; - bActuator *act; - - RNA_string_get(op->ptr, "actuator", actuator_name); - - *ob = edit_object_property_get(C, op); - if (!*ob) return NULL; - - act = BLI_findstring(&((*ob)->actuators), actuator_name, offsetof(bActuator, name)); - return act; -} - -static int logicbricks_move_property_get(wmOperator *op) -{ - int type = RNA_enum_get(op->ptr, "direction"); - - if (type == 1) - return true; - else - return false; -} - -/* ************* Add/Remove Sensor Operator ************* */ - -static int sensor_remove_exec(bContext *C, wmOperator *op) -{ - Object *ob = NULL; - bSensor *sens = edit_sensor_property_get(C, op, &ob); - - if (!sens) - return OPERATOR_CANCELLED; - - BLI_remlink(&(ob->sensors), sens); - free_sensor(sens); - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -static int sensor_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) -{ - if (edit_sensor_invoke_properties(C, op)) - return sensor_remove_exec(C, op); - else - return OPERATOR_CANCELLED; -} - -static void LOGIC_OT_sensor_remove(wmOperatorType *ot) -{ - ot->name = "Remove Sensor"; - ot->description = "Remove a sensor from the active object"; - ot->idname = "LOGIC_OT_sensor_remove"; - - ot->invoke = sensor_remove_invoke; - ot->exec = sensor_remove_exec; - ot->poll = edit_sensor_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - edit_sensor_properties(ot); -} - -static int sensor_add_exec(bContext *C, wmOperator *op) -{ - Object *ob; - bSensor *sens; - PointerRNA sens_ptr; - PropertyRNA *prop; - const char *sens_name; - char name[MAX_NAME]; - int type = RNA_enum_get(op->ptr, "type"); - - ob = edit_object_property_get(C, op); - if (!ob) - return OPERATOR_CANCELLED; - - sens = new_sensor(type); - BLI_addtail(&(ob->sensors), sens); - - /* set the sensor name based on rna type enum */ - RNA_pointer_create((ID *)ob, &RNA_Sensor, sens, &sens_ptr); - prop = RNA_struct_find_property(&sens_ptr, "type"); - - RNA_string_get(op->ptr, "name", name); - if (*name) { - BLI_strncpy(sens->name, name, sizeof(sens->name)); - } - else { - RNA_property_enum_name(C, &sens_ptr, prop, RNA_property_enum_get(&sens_ptr, prop), &sens_name); - BLI_strncpy(sens->name, sens_name, sizeof(sens->name)); - } - - BLI_uniquename(&ob->sensors, sens, DATA_("Sensor"), '.', offsetof(bSensor, name), sizeof(sens->name)); - ob->scaflag |= OB_SHOWSENS; - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -static void LOGIC_OT_sensor_add(wmOperatorType *ot) -{ - PropertyRNA *prop; - - /* identifiers */ - ot->name = "Add Sensor"; - ot->description = "Add a sensor to the active object"; - ot->idname = "LOGIC_OT_sensor_add"; - - /* api callbacks */ - ot->invoke = WM_menu_invoke; - ot->exec = sensor_add_exec; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - - /* properties */ - ot->prop = prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add"); - RNA_def_enum_funcs(prop, rna_Sensor_type_itemf); - prop = RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the Sensor to add"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the Object to add the Sensor to"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); -} - -/* ************* Add/Remove Controller Operator ************* */ - -static int controller_remove_exec(bContext *C, wmOperator *op) -{ - Object *ob = NULL; - bController *cont = edit_controller_property_get(C, op, &ob); - - if (!cont) - return OPERATOR_CANCELLED; - - BLI_remlink(&(ob->controllers), cont); - unlink_controller(cont); - free_controller(cont); - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -static int controller_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) -{ - if (edit_controller_invoke_properties(C, op)) - return controller_remove_exec(C, op); - else - return OPERATOR_CANCELLED; -} - -static void LOGIC_OT_controller_remove(wmOperatorType *ot) -{ - ot->name = "Remove Controller"; - ot->description = "Remove a controller from the active object"; - ot->idname = "LOGIC_OT_controller_remove"; - - ot->invoke = controller_remove_invoke; - ot->exec = controller_remove_exec; - ot->poll = edit_controller_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - edit_controller_properties(ot); -} - -static int controller_add_exec(bContext *C, wmOperator *op) -{ - Object *ob; - bController *cont; - PointerRNA cont_ptr; - PropertyRNA *prop; - const char *cont_name; - int bit; - char name[MAX_NAME]; - int type = RNA_enum_get(op->ptr, "type"); - - ob = edit_object_property_get(C, op); - if (!ob) - return OPERATOR_CANCELLED; - - cont = new_controller(type); - BLI_addtail(&(ob->controllers), cont); - - /* set the controller name based on rna type enum */ - RNA_pointer_create((ID *)ob, &RNA_Controller, cont, &cont_ptr); - prop = RNA_struct_find_property(&cont_ptr, "type"); - - RNA_string_get(op->ptr, "name", name); - if (*name) { - BLI_strncpy(cont->name, name, sizeof(cont->name)); - } - else { - RNA_property_enum_name(C, &cont_ptr, prop, RNA_property_enum_get(&cont_ptr, prop), &cont_name); - BLI_strncpy(cont->name, cont_name, sizeof(cont->name)); - } - - BLI_uniquename(&ob->controllers, cont, DATA_("Controller"), '.', offsetof(bController, name), sizeof(cont->name)); - - /* set the controller state mask from the current object state. - * A controller is always in a single state, so select the lowest bit set - * from the object state */ - for (bit = 0; bit < OB_MAX_STATES; bit++) { - if (ob->state & (1 << bit)) - break; - } - cont->state_mask = (1 << bit); - if (cont->state_mask == 0) { - /* shouldn't happen, object state is never 0 */ - cont->state_mask = 1; - } - - ob->scaflag |= OB_SHOWCONT; - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -static void LOGIC_OT_controller_add(wmOperatorType *ot) -{ - PropertyRNA *prop; - - /* identifiers */ - ot->name = "Add Controller"; - ot->description = "Add a controller to the active object"; - ot->idname = "LOGIC_OT_controller_add"; - - /* api callbacks */ - ot->invoke = WM_menu_invoke; - ot->exec = controller_add_exec; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - - /* properties */ - ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add"); - prop = RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the Controller to add"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the Object to add the Controller to"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); -} - -/* ************* Add/Remove Actuator Operator ************* */ - -static int actuator_remove_exec(bContext *C, wmOperator *op) -{ - Object *ob = NULL; - bActuator *act = edit_actuator_property_get(C, op, &ob); - - if (!act) - return OPERATOR_CANCELLED; - - BLI_remlink(&(ob->actuators), act); - unlink_actuator(act); - free_actuator(act); - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -static int actuator_remove_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) -{ - if (edit_actuator_invoke_properties(C, op)) - return actuator_remove_exec(C, op); - else - return OPERATOR_CANCELLED; -} - -static void LOGIC_OT_actuator_remove(wmOperatorType *ot) -{ - ot->name = "Remove Actuator"; - ot->description = "Remove an actuator from the active object"; - ot->idname = "LOGIC_OT_actuator_remove"; - - ot->invoke = actuator_remove_invoke; - ot->exec = actuator_remove_exec; - ot->poll = edit_actuator_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - edit_actuator_properties(ot); -} - -static int actuator_add_exec(bContext *C, wmOperator *op) -{ - Object *ob; - bActuator *act; - PointerRNA act_ptr; - PropertyRNA *prop; - const char *act_name; - char name[MAX_NAME]; - int type = RNA_enum_get(op->ptr, "type"); - - ob = edit_object_property_get(C, op); - if (!ob) - return OPERATOR_CANCELLED; - - act = new_actuator(type); - BLI_addtail(&(ob->actuators), act); - - /* set the actuator name based on rna type enum */ - RNA_pointer_create((ID *)ob, &RNA_Actuator, act, &act_ptr); - prop = RNA_struct_find_property(&act_ptr, "type"); - - RNA_string_get(op->ptr, "name", name); - if (*name) { - BLI_strncpy(act->name, name, sizeof(act->name)); - } - else { - RNA_property_enum_name(C, &act_ptr, prop, RNA_property_enum_get(&act_ptr, prop), &act_name); - BLI_strncpy(act->name, act_name, sizeof(act->name)); - } - - BLI_uniquename(&ob->actuators, act, DATA_("Actuator"), '.', offsetof(bActuator, name), sizeof(act->name)); - ob->scaflag |= OB_SHOWACT; - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -static void LOGIC_OT_actuator_add(wmOperatorType *ot) -{ - PropertyRNA *prop; - - /* identifiers */ - ot->name = "Add Actuator"; - ot->description = "Add an actuator to the active object"; - ot->idname = "LOGIC_OT_actuator_add"; - - /* api callbacks */ - ot->invoke = WM_menu_invoke; - ot->exec = actuator_add_exec; - ot->poll = ED_operator_object_active_editable; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - - /* properties */ - ot->prop = prop = RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add"); - RNA_def_enum_funcs(prop, rna_Actuator_type_itemf); - prop = RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the Actuator to add"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_string(ot->srna, "object", NULL, MAX_NAME, "Object", "Name of the Object to add the Actuator to"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); -} - -/* ************* Move Logic Bricks Operator ************* */ -static const EnumPropertyItem logicbricks_move_direction[] = { - {1, "UP", 0, "Move Up", ""}, - {2, "DOWN", 0, "Move Down", ""}, - {0, NULL, 0, NULL, NULL} -}; - - -static int sensor_move_exec(bContext *C, wmOperator *op) -{ - Object *ob = NULL; - bSensor *sens = edit_sensor_property_get(C, op, &ob); - int move_up = logicbricks_move_property_get(op); - - if (!sens) - return OPERATOR_CANCELLED; - - sca_move_sensor(sens, ob, move_up); - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -static int sensor_move_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) -{ - if (edit_sensor_invoke_properties(C, op)) { - return sensor_move_exec(C, op); - } - else - return OPERATOR_CANCELLED; -} - -static void LOGIC_OT_sensor_move(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Move Sensor"; - ot->description = "Move Sensor"; - ot->idname = "LOGIC_OT_sensor_move"; - - /* api callbacks */ - ot->invoke = sensor_move_invoke; - ot->exec = sensor_move_exec; - ot->poll = edit_sensor_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - - /* properties */ - edit_sensor_properties(ot); - RNA_def_enum(ot->srna, "direction", logicbricks_move_direction, 1, "Direction", "Move Up or Down"); -} - -static int controller_move_exec(bContext *C, wmOperator *op) -{ - Object *ob = NULL; - bController *cont = edit_controller_property_get(C, op, &ob); - int move_up = logicbricks_move_property_get(op); - - if (!cont) - return OPERATOR_CANCELLED; - - sca_move_controller(cont, ob, move_up); - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -static int controller_move_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) -{ - if (edit_controller_invoke_properties(C, op)) { - return controller_move_exec(C, op); - } - else - return OPERATOR_CANCELLED; -} - -static void LOGIC_OT_controller_move(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Move Controller"; - ot->description = "Move Controller"; - ot->idname = "LOGIC_OT_controller_move"; - - /* api callbacks */ - ot->invoke = controller_move_invoke; - ot->exec = controller_move_exec; - ot->poll = edit_controller_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - - /* properties */ - edit_controller_properties(ot); - RNA_def_enum(ot->srna, "direction", logicbricks_move_direction, 1, "Direction", "Move Up or Down"); -} - -static int actuator_move_exec(bContext *C, wmOperator *op) -{ - Object *ob = NULL; - bActuator *act = edit_actuator_property_get(C, op, &ob); - int move_up = logicbricks_move_property_get(op); - - if (!act) - return OPERATOR_CANCELLED; - - sca_move_actuator(act, ob, move_up); - - WM_event_add_notifier(C, NC_LOGIC, NULL); - - return OPERATOR_FINISHED; -} - -static int actuator_move_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) -{ - if (edit_actuator_invoke_properties(C, op)) { - return actuator_move_exec(C, op); - } - else - return OPERATOR_CANCELLED; -} - -static void LOGIC_OT_actuator_move(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Move Actuator"; - ot->description = "Move Actuator"; - ot->idname = "LOGIC_OT_actuator_move"; - - /* api callbacks */ - ot->invoke = actuator_move_invoke; - ot->exec = actuator_move_exec; - ot->poll = edit_actuator_poll; - - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; - - /* properties */ - edit_actuator_properties(ot); - RNA_def_enum(ot->srna, "direction", logicbricks_move_direction, 1, "Direction", "Move Up or Down"); -} - -/* ************************ view ********************* */ - -static int logic_view_all_exec(bContext *C, wmOperator *op) -{ - ARegion *ar = CTX_wm_region(C); - rctf cur_new = ar->v2d.tot; - float aspect = BLI_rctf_size_y(&ar->v2d.cur) / BLI_rctf_size_x(&ar->v2d.cur); - const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); - - /* force the view2d code to zoom to width, not height */ - cur_new.ymin = cur_new.ymax - BLI_rctf_size_x(&cur_new) * aspect; - - UI_view2d_smooth_view(C, ar, &cur_new, smooth_viewtx); - - return OPERATOR_FINISHED; -} - -static void LOGIC_OT_view_all(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "View All"; - ot->idname = "LOGIC_OT_view_all"; - ot->description = "Resize view so you can see all logic bricks"; - - /* api callbacks */ - ot->exec = logic_view_all_exec; - ot->poll = ED_operator_logic_active; - - /* flags */ - ot->flag = 0; -} - -/* ************************* */ - -void ED_operatortypes_logic(void) -{ - WM_operatortype_append(LOGIC_OT_sensor_remove); - WM_operatortype_append(LOGIC_OT_sensor_add); - WM_operatortype_append(LOGIC_OT_sensor_move); - WM_operatortype_append(LOGIC_OT_controller_remove); - WM_operatortype_append(LOGIC_OT_controller_add); - WM_operatortype_append(LOGIC_OT_controller_move); - WM_operatortype_append(LOGIC_OT_actuator_remove); - WM_operatortype_append(LOGIC_OT_actuator_add); - WM_operatortype_append(LOGIC_OT_actuator_move); - WM_operatortype_append(LOGIC_OT_view_all); -} diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c deleted file mode 100644 index 9bdc92f98ab..00000000000 --- a/source/blender/editors/space_logic/logic_window.c +++ /dev/null @@ -1,2594 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): Blender Foundation - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/editors/space_logic/logic_window.c - * \ingroup splogic - */ - - -#include <string.h> -#include <stdio.h> -#include <stddef.h> -#include <float.h> - -#include "DNA_actuator_types.h" -#include "DNA_controller_types.h" -#include "DNA_property_types.h" -#include "DNA_space_types.h" -#include "DNA_scene_types.h" -#include "DNA_screen_types.h" -#include "DNA_sensor_types.h" -#include "DNA_constraint_types.h" -#include "DNA_object_types.h" - -#include "MEM_guardedalloc.h" - -#include "BLI_blenlib.h" -#include "BLI_string_utils.h" -#include "BLI_utildefines.h" - -#include "BKE_action.h" -#include "BKE_context.h" -#include "BKE_library.h" -#include "BKE_main.h" -#include "BKE_sca.h" - -#include "ED_undo.h" - -#include "BLT_translation.h" - -#include "UI_interface.h" -#include "UI_view2d.h" - -#include "RNA_access.h" - -/* XXX BAD BAD */ -#include "../interface/interface_intern.h" - -#include "logic_intern.h" - -#define B_REDR 1 - -#define B_ADD_SENS 2703 -#define B_CHANGE_SENS 2704 -#define B_DEL_SENS 2705 - -#define B_ADD_CONT 2706 -#define B_CHANGE_CONT 2707 -#define B_DEL_CONT 2708 - -#define B_ADD_ACT 2709 -#define B_CHANGE_ACT 2710 -#define B_DEL_ACT 2711 - -#define B_SOUNDACT_BROWSE 2712 - -#define B_SETPROP 2714 -#define B_SETACTOR 2715 -#define B_SETMAINACTOR 2716 -#define B_SETDYNA 2717 -#define B_SET_STATE_BIT 2718 -#define B_INIT_STATE_BIT 2719 - -/* proto */ -static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag); - -static void do_logic_buts(bContext *C, void *UNUSED(arg), int event) -{ - Main *bmain= CTX_data_main(C); - bSensor *sens; - bController *cont; - bActuator *act; - Object *ob; - int didit, bit; - - ob= CTX_data_active_object(C); - if (ob==NULL) return; - - switch (event) { - - case B_SETPROP: - /* check for inconsistent types */ - ob->gameflag &= ~(OB_SECTOR|OB_MAINACTOR|OB_DYNAMIC|OB_ACTOR); - break; - - case B_SETACTOR: - case B_SETDYNA: - case B_SETMAINACTOR: - ob->gameflag &= ~(OB_SECTOR|OB_PROP); - break; - - case B_ADD_SENS: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - if (ob->scaflag & OB_ADDSENS) { - ob->scaflag &= ~OB_ADDSENS; - sens= new_sensor(SENS_ALWAYS); - BLI_addtail(&(ob->sensors), sens); - BLI_uniquename(&ob->sensors, sens, DATA_("Sensor"), '.', offsetof(bSensor, name), sizeof(sens->name)); - ob->scaflag |= OB_SHOWSENS; - } - } - - ED_undo_push(C, "Add sensor"); - break; - - case B_CHANGE_SENS: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - sens= ob->sensors.first; - while (sens) { - if (sens->type != sens->otype) { - init_sensor(sens); - sens->otype= sens->type; - break; - } - sens= sens->next; - } - } - break; - - case B_DEL_SENS: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - sens= ob->sensors.first; - while (sens) { - if (sens->flag & SENS_DEL) { - BLI_remlink(&(ob->sensors), sens); - free_sensor(sens); - break; - } - sens= sens->next; - } - } - ED_undo_push(C, "Delete sensor"); - break; - - case B_ADD_CONT: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - if (ob->scaflag & OB_ADDCONT) { - ob->scaflag &= ~OB_ADDCONT; - cont= new_controller(CONT_LOGIC_AND); - BLI_uniquename(&ob->controllers, cont, DATA_("Controller"), '.', offsetof(bController, name), sizeof(cont->name)); - ob->scaflag |= OB_SHOWCONT; - BLI_addtail(&(ob->controllers), cont); - /* set the controller state mask from the current object state. - * A controller is always in a single state, so select the lowest bit set - * from the object state */ - for (bit=0; bit<32; bit++) { - if (ob->state & (1<<bit)) - break; - } - cont->state_mask = (1<<bit); - if (cont->state_mask == 0) { - /* shouldn't happen, object state is never 0 */ - cont->state_mask = 1; - } - } - } - ED_undo_push(C, "Add controller"); - break; - - case B_SET_STATE_BIT: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - if (ob->scaflag & OB_ALLSTATE) { - ob->scaflag &= ~OB_ALLSTATE; - ob->state = 0x3FFFFFFF; - } - } - break; - - case B_INIT_STATE_BIT: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - if (ob->scaflag & OB_INITSTBIT) { - ob->scaflag &= ~OB_INITSTBIT; - ob->state = ob->init_state; - if (!ob->state) - ob->state = 1; - } - } - break; - - case B_CHANGE_CONT: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - cont= ob->controllers.first; - while (cont) { - if (cont->type != cont->otype) { - init_controller(cont); - cont->otype= cont->type; - break; - } - cont= cont->next; - } - } - break; - - - case B_DEL_CONT: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - cont= ob->controllers.first; - while (cont) { - if (cont->flag & CONT_DEL) { - BLI_remlink(&(ob->controllers), cont); - unlink_controller(cont); - free_controller(cont); - break; - } - cont= cont->next; - } - } - ED_undo_push(C, "Delete controller"); - break; - - case B_ADD_ACT: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - if (ob->scaflag & OB_ADDACT) { - ob->scaflag &= ~OB_ADDACT; - act= new_actuator(ACT_OBJECT); - BLI_uniquename(&ob->actuators, act, DATA_("Actuator"), '.', offsetof(bActuator, name), sizeof(act->name)); - BLI_addtail(&(ob->actuators), act); - ob->scaflag |= OB_SHOWACT; - } - } - ED_undo_push(C, "Add actuator"); - break; - - case B_CHANGE_ACT: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - act= ob->actuators.first; - while (act) { - if (act->type != act->otype) { - init_actuator(act); - act->otype= act->type; - break; - } - act= act->next; - } - } - break; - - case B_DEL_ACT: - for (ob=bmain->object.first; ob; ob=ob->id.next) { - act= ob->actuators.first; - while (act) { - if (act->flag & ACT_DEL) { - BLI_remlink(&(ob->actuators), act); - unlink_actuator(act); - free_actuator(act); - break; - } - act= act->next; - } - } - ED_undo_push(C, "Delete actuator"); - break; - - case B_SOUNDACT_BROWSE: - /* since we don't know which... */ - didit= 0; - for (ob=bmain->object.first; ob; ob=ob->id.next) { - act= ob->actuators.first; - while (act) { - if (act->type==ACT_SOUND) { - bSoundActuator *sa= act->data; - if (sa->sndnr) { - ID *sound= bmain->sound.first; - int nr= 1; - - if (sa->sndnr == -2) { -// XXX activate_databrowse((ID *)bmain->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE, -// &sa->sndnr, do_logic_buts); - break; - } - - while (sound) { - if (nr==sa->sndnr) - break; - nr++; - sound= sound->next; - } - - if (sa->sound) - id_us_min(((ID *)sa->sound)); - - sa->sound= (struct bSound *)sound; - - if (sound) { - id_us_plus(sound); - } - - sa->sndnr= 0; - didit= 1; - } - } - act= act->next; - } - if (didit) - break; - } - - break; - } -} - - -static const char *sensor_name(int type) -{ - switch (type) { - case SENS_ALWAYS: - return N_("Always"); - case SENS_NEAR: - return N_("Near"); - case SENS_KEYBOARD: - return N_("Keyboard"); - case SENS_PROPERTY: - return N_("Property"); - case SENS_ARMATURE: - return N_("Armature"); - case SENS_ACTUATOR: - return N_("Actuator"); - case SENS_DELAY: - return N_("Delay"); - case SENS_MOUSE: - return N_("Mouse"); - case SENS_COLLISION: - return N_("Collision"); - case SENS_RADAR: - return N_("Radar"); - case SENS_RANDOM: - return N_("Random"); - case SENS_RAY: - return N_("Ray"); - case SENS_MESSAGE: - return N_("Message"); - case SENS_JOYSTICK: - return N_("Joystick"); - } - return N_("Unknown"); -} - -static const char *controller_name(int type) -{ - switch (type) { - case CONT_LOGIC_AND: - return N_("And"); - case CONT_LOGIC_OR: - return N_("Or"); - case CONT_LOGIC_NAND: - return N_("Nand"); - case CONT_LOGIC_NOR: - return N_("Nor"); - case CONT_LOGIC_XOR: - return N_("Xor"); - case CONT_LOGIC_XNOR: - return N_("Xnor"); - case CONT_EXPRESSION: - return N_("Expression"); - case CONT_PYTHON: - return N_("Python"); - } - return N_("Unknown"); -} - -static const char *actuator_name(int type) -{ - switch (type) { - case ACT_SHAPEACTION: - return N_("Shape Action"); - case ACT_ACTION: - return N_("Action"); - case ACT_OBJECT: - return N_("Motion"); - case ACT_LAMP: - return N_("Lamp"); - case ACT_CAMERA: - return N_("Camera"); - case ACT_MATERIAL: - return N_("Material"); - case ACT_SOUND: - return N_("Sound"); - case ACT_PROPERTY: - return N_("Property"); - case ACT_EDIT_OBJECT: - return N_("Edit Object"); - case ACT_CONSTRAINT: - return N_("Constraint"); - case ACT_SCENE: - return N_("Scene"); - case ACT_GROUP: - return N_("Group"); - case ACT_RANDOM: - return N_("Random"); - case ACT_MESSAGE: - return N_("Message"); - case ACT_GAME: - return N_("Game"); - case ACT_VISIBILITY: - return N_("Visibility"); - case ACT_2DFILTER: - return N_("Filter 2D"); - case ACT_PARENT: - return N_("Parent"); - case ACT_STATE: - return N_("State"); - case ACT_ARMATURE: - return N_("Armature"); - case ACT_STEERING: - return N_("Steering"); - case ACT_MOUSE: - return N_("Mouse"); - } - return N_("Unknown"); -} - -static void set_sca_ob(Object *ob) -{ - bController *cont; - bActuator *act; - - cont= ob->controllers.first; - while (cont) { - cont->mynew= (bController *)ob; - cont= cont->next; - } - act= ob->actuators.first; - while (act) { - act->mynew= (bActuator *)ob; - act= act->next; - } -} - -static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag) -{ - Base *base; - Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob, *obt, *obact = CTX_data_active_object(C); - ID **idar; - bSensor *sens; - bController *cont; - int a, nr, do_it; - - /* we need a sorted object list */ - /* set scavisflags flags in Objects to indicate these should be evaluated */ - /* also hide ob pointers in ->new entries of controllerss/actuators */ - - *count= 0; - - if (scene==NULL) return NULL; - - ob= bmain->object.first; - while (ob) { - ob->scavisflag= 0; - set_sca_ob(ob); - ob= ob->id.next; - } - - for (base = FIRSTBASE(view_layer); base; base = base->next) { - if ((base->flag & BASE_VISIBLED) && (base->flag & SELECT)) { - if (scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS; - if (scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT; - if (scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT; - } - } - - if (obact) { - if (scavisflag & BUTS_SENS_ACT) obact->scavisflag |= OB_VIS_SENS; - if (scavisflag & BUTS_CONT_ACT) obact->scavisflag |= OB_VIS_CONT; - if (scavisflag & BUTS_ACT_ACT) obact->scavisflag |= OB_VIS_ACT; - } - - /* BUTS_XXX_STATE are similar to BUTS_XXX_LINK for selecting the object */ - if (scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) { - do_it = true; - while (do_it) { - do_it = false; - - ob= bmain->object.first; - while (ob) { - - /* 1st case: select sensor when controller selected */ - if ((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) { - sens= ob->sensors.first; - while (sens) { - for (a=0; a<sens->totlinks; a++) { - if (sens->links[a]) { - obt= (Object *)sens->links[a]->mynew; - if (obt && (obt->scavisflag & OB_VIS_CONT)) { - do_it = true; - ob->scavisflag |= OB_VIS_SENS; - break; - } - } - } - if (do_it) break; - sens= sens->next; - } - } - - /* 2nd case: select cont when act selected */ - if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_CONT)==0) { - cont= ob->controllers.first; - while (cont) { - for (a=0; a<cont->totlinks; a++) { - if (cont->links[a]) { - obt= (Object *)cont->links[a]->mynew; - if (obt && (obt->scavisflag & OB_VIS_ACT)) { - do_it = true; - ob->scavisflag |= OB_VIS_CONT; - break; - } - } - } - if (do_it) break; - cont= cont->next; - } - } - - /* 3rd case: select controller when sensor selected */ - if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) { - sens= ob->sensors.first; - while (sens) { - for (a=0; a<sens->totlinks; a++) { - if (sens->links[a]) { - obt= (Object *)sens->links[a]->mynew; - if (obt && (obt->scavisflag & OB_VIS_CONT)==0) { - do_it = true; - obt->scavisflag |= OB_VIS_CONT; - } - } - } - sens= sens->next; - } - } - - /* 4th case: select actuator when controller selected */ - if ((scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE)) && (ob->scavisflag & OB_VIS_CONT)) { - cont= ob->controllers.first; - while (cont) { - for (a=0; a<cont->totlinks; a++) { - if (cont->links[a]) { - obt= (Object *)cont->links[a]->mynew; - if (obt && (obt->scavisflag & OB_VIS_ACT)==0) { - do_it = true; - obt->scavisflag |= OB_VIS_ACT; - } - } - } - cont= cont->next; - } - - } - ob= ob->id.next; - } - } - } - - /* now we count */ - ob= bmain->object.first; - while (ob) { - if ( ob->scavisflag ) (*count)++; - ob= ob->id.next; - } - - if (*count == 0) return NULL; - if (*count > 24) *count = 24; /* temporal */ - - idar= MEM_callocN((*count)*sizeof(void *), "idar"); - - ob= bmain->object.first; - nr= 0; - - /* make the active object always the first one of the list */ - if (obact) { - idar[0] = (ID *)obact; - nr++; - } - - while (ob) { - if ((ob->scavisflag) && (ob != obact)) { - idar[nr] = (ID *)ob; - nr++; - } - if (nr >= 24) break; - ob= ob->id.next; - } - - /* just to be sure... these were set in set_sca_done_ob() */ - clear_sca_new_poins(); - - return idar; -} - -static void get_armature_bone_constraint(Object *ob, const char *posechannel, const char *constraint_name, bConstraint **constraint) -{ - /* check that bone exist in the active object */ - if (ob->type == OB_ARMATURE && ob->pose) { - bPoseChannel *pchan= BKE_pose_channel_find_name(ob->pose, posechannel); - if (pchan) { - bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name)); - if (con) { - *constraint= con; - } - } - } - /* didn't find any */ -} - -static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event) -{ - SpaceLogic *slogic= CTX_wm_space_logic(C); - ID **idar; - Object *ob; - bSensor *sens; - short count, a; - - idar= get_selected_and_linked_obs(C, &count, slogic->scaflag); - - for (a=0; a<count; a++) { - ob= (Object *)idar[a]; - if (event==0 || event==2) ob->scaflag |= OB_SHOWSENS; - else if (event==1) ob->scaflag &= ~OB_SHOWSENS; - } - - for (a=0; a<count; a++) { - ob= (Object *)idar[a]; - sens= ob->sensors.first; - while (sens) { - if (event==2) sens->flag |= SENS_SHOW; - else if (event==3) sens->flag &= ~SENS_SHOW; - sens= sens->next; - } - } - - if (idar) MEM_freeN(idar); -} - -static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) -{ - uiBlock *block; - int yco=0; - - block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); - UI_block_func_butmenu_set(block, do_sensor_menu, NULL); - - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Sensors"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); - - UI_block_direction_set(block, UI_DIR_UP); - UI_block_end(C, block); - - return block; -} - -static void do_controller_menu(bContext *C, void *UNUSED(arg), int event) -{ - SpaceLogic *slogic= CTX_wm_space_logic(C); - ID **idar; - Object *ob; - bController *cont; - short count, a; - - idar= get_selected_and_linked_obs(C, &count, slogic->scaflag); - - for (a=0; a<count; a++) { - ob= (Object *)idar[a]; - if (event==0 || event==2) ob->scaflag |= OB_SHOWCONT; - else if (event==1) ob->scaflag &= ~OB_SHOWCONT; - } - - for (a=0; a<count; a++) { - ob= (Object *)idar[a]; - cont= ob->controllers.first; - while (cont) { - if (event==2) cont->flag |= CONT_SHOW; - else if (event==3) cont->flag &= ~CONT_SHOW; - cont= cont->next; - } - } - - if (idar) MEM_freeN(idar); -} - -static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) -{ - uiBlock *block; - int yco=0; - - block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); - UI_block_func_butmenu_set(block, do_controller_menu, NULL); - - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, ""); - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Controllers"), 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, ""); - - UI_block_direction_set(block, UI_DIR_UP); - UI_block_end(C, block); - - return block; -} - -static void do_actuator_menu(bContext *C, void *UNUSED(arg), int event) -{ - SpaceLogic *slogic= CTX_wm_space_logic(C); - ID **idar; - Object *ob; - bActuator *act; - short count, a; - - idar= get_selected_and_linked_obs(C, &count, slogic->scaflag); - - for (a=0; a<count; a++) { - ob= (Object *)idar[a]; - if (event==0 || event==2) ob->scaflag |= OB_SHOWACT; - else if (event==1) ob->scaflag &= ~OB_SHOWACT; - } - - for (a=0; a<count; a++) { - ob= (Object *)idar[a]; - act= ob->actuators.first; - while (act) { - if (event==2) act->flag |= ACT_SHOW; - else if (event==3) act->flag &= ~ACT_SHOW; - act= act->next; - } - } - - if (idar) MEM_freeN(idar); -} - -static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) -{ - uiBlock *block; - int xco=0; - - block= UI_block_begin(C, ar, __func__, UI_EMBOSS_PULLDOWN); - UI_block_func_butmenu_set(block, do_actuator_menu, NULL); - - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Objects"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefBut(block, UI_BTYPE_SEPR_LINE, 0, "", 0, (short)(xco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Show Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefBut(block, UI_BTYPE_BUT_MENU, 1, IFACE_("Hide Actuators"), 0, (short)(xco-=20), 160, 19, NULL, 0.0, 0.0, 1, 3, ""); - - UI_block_direction_set(block, UI_DIR_UP); - UI_block_end(C, block); - - return block; -} - -static void check_controller_state_mask(bContext *UNUSED(C), void *arg1_but, void *arg2_mask) -{ - unsigned int *cont_mask = arg2_mask; - uiBut *but = arg1_but; - - /* a controller is always in a single state */ - *cont_mask = (1<<but->retval); - but->retval = B_REDR; -} - -static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_cont) -{ - uiBlock *block; - uiBut *but; - bController *cont = arg_cont; - - short yco = 12, xco = 0, stbit, offset; - - block= UI_block_begin(C, ar, __func__, UI_EMBOSS); - - /* use this for a fake extra empy space around the buttons */ - uiDefBut(block, UI_BTYPE_LABEL, 0, "", -5, -5, 200, 34, NULL, 0, 0, 0, 0, ""); - - for (offset=0; offset<15; offset += 5) { - UI_block_align_begin(block); - for (stbit=0; stbit<5; stbit++) { - but = uiDefButBitI(block, UI_BTYPE_TOGGLE, (1<<(stbit+offset)), (stbit+offset), "", (short)(xco+12*stbit+13*offset), yco, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); - UI_but_func_set(but, check_controller_state_mask, but, &(cont->state_mask)); - } - for (stbit=0; stbit<5; stbit++) { - but = uiDefButBitI(block, UI_BTYPE_TOGGLE, (1<<(stbit+offset+15)), (stbit+offset+15), "", (short)(xco+12*stbit+13*offset), yco-12, 12, 12, (int *)&(cont->state_mask), 0, 0, 0, 0, ""); - UI_but_func_set(but, check_controller_state_mask, but, &(cont->state_mask)); - } - } - UI_block_align_end(block); - - UI_block_direction_set(block, UI_DIR_UP); - UI_block_end(C, block); - - return block; -} - -static bool is_sensor_linked(uiBlock *block, bSensor *sens) -{ - bController *cont; - int i; - - for (i=0; i<sens->totlinks; i++) { - cont = sens->links[i]; - if (UI_block_links_find_inlink(block, cont) != NULL) - return 1; - } - return 0; -} - -/* Sensors code */ - -static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr) -{ - uiLayout *box, *row, *sub; - bSensor *sens= (bSensor *)ptr->data; - - box = uiLayoutBox(layout); - row = uiLayoutRow(box, false); - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemR(sub, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE); - if (RNA_boolean_get(ptr, "show_expanded")) { - uiItemR(sub, ptr, "type", 0, "", ICON_NONE); - uiItemR(sub, ptr, "name", 0, "", ICON_NONE); - } - else { - uiItemL(sub, IFACE_(sensor_name(sens->type)), ICON_NONE); - uiItemL(sub, sens->name, ICON_NONE); - } - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, (((RNA_boolean_get(logic_ptr, "show_sensors_active_states") && - RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")) && - RNA_boolean_get(ptr, "active"))); - uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); - - if (RNA_boolean_get(ptr, "show_expanded")==0) { - sub = uiLayoutRow(row, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up - uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down - } - - sub = uiLayoutRow(row, false); - uiItemR(sub, ptr, "active", 0, "", ICON_NONE); - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemO(sub, "", ICON_X, "LOGIC_OT_sensor_remove"); -} - -static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *box, *split, *sub, *row; - - box = uiLayoutBox(layout); - uiLayoutSetActive(box, RNA_boolean_get(ptr, "active")); - split = uiLayoutSplit(box, 0.45f, false); - - row = uiLayoutRow(split, true); - uiItemR(row, ptr, "use_pulse_true_level", 0, "", ICON_DOTSUP); - uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN); - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") || - RNA_boolean_get(ptr, "use_pulse_false_level"))); - uiItemR(sub, ptr, "tick_skip", 0, IFACE_("Skip"), ICON_NONE); - - row = uiLayoutRow(split, true); - uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - uiItemR(split, ptr, "invert", UI_ITEM_R_TOGGLE, IFACE_("Invert"), ICON_NONE); -} -/* sensors in alphabetical order */ - -static void draw_sensor_actuator(uiLayout *layout, PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->id.data; - PointerRNA settings_ptr; - - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - uiItemPointerR(layout, ptr, "actuator", &settings_ptr, "actuators", NULL, ICON_LOGIC); -} - -static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr) -{ - bSensor *sens = (bSensor *)ptr->data; - bArmatureSensor *as = (bArmatureSensor *) sens->data; - Object *ob = (Object *)ptr->id.data; - uiLayout *row; - - if (ob->type != OB_ARMATURE) { - uiItemL(layout, IFACE_("Sensor only available for armatures"), ICON_NONE); - return; - } - - if (ob->pose) { - PointerRNA pose_ptr, pchan_ptr; - PropertyRNA *bones_prop; - - RNA_pointer_create((ID *)ob, &RNA_Pose, ob->pose, &pose_ptr); - bones_prop = RNA_struct_find_property(&pose_ptr, "bones"); - - uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); - - if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, as->posechannel, &pchan_ptr)) - uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); - } - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "test_type", 0, NULL, ICON_NONE); - if (RNA_enum_get(ptr, "test_type") != SENS_ARM_STATE_CHANGED) - uiItemR(row, ptr, "value", 0, NULL, ICON_NONE); -} - -static void draw_sensor_collision(uiLayout *layout, PointerRNA *ptr, bContext *C) -{ - uiLayout *row, *split; - PointerRNA main_ptr; - - RNA_main_pointer_create(CTX_data_main(C), &main_ptr); - - split = uiLayoutSplit(layout, 0.3f, false); - row = uiLayoutRow(split, true); - uiItemR(row, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(row, ptr, "use_material", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - switch (RNA_boolean_get(ptr, "use_material")) { - case SENS_COLLISION_PROPERTY: - uiItemR(split, ptr, "property", 0, NULL, ICON_NONE); - break; - case SENS_COLLISION_MATERIAL: - uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA); - break; - } -} - -static void draw_sensor_delay(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *row; - - row = uiLayoutRow(layout, false); - - uiItemR(row, ptr, "delay", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "duration", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "use_repeat", 0, NULL, ICON_NONE); -} - -static void draw_sensor_joystick(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *col, *row; - - uiItemR(layout, ptr, "joystick_index", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "event_type", 0, NULL, ICON_NONE); - - switch (RNA_enum_get(ptr, "event_type")) { - case SENS_JOY_BUTTON: - uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == false); - uiItemR(col, ptr, "button_number", 0, NULL, ICON_NONE); - break; - case SENS_JOY_AXIS: - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "axis_number", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NONE); - - uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE); - col = uiLayoutColumn(layout, false); - uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == false); - uiItemR(col, ptr, "axis_direction", 0, NULL, ICON_NONE); - break; - case SENS_JOY_HAT: - uiItemR(layout, ptr, "hat_number", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == false); - uiItemR(col, ptr, "hat_direction", 0, NULL, ICON_NONE); - break; - case SENS_JOY_AXIS_SINGLE: - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "single_axis_number", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NONE); - break; - } -} - -static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->id.data; - PointerRNA settings_ptr; - uiLayout *row, *col; - - row = uiLayoutRow(layout, false); - uiItemL(row, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, "Key:"), ICON_NONE); - col = uiLayoutColumn(row, false); - uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == false); - uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE); - col = uiLayoutColumn(row, false); - uiItemR(col, ptr, "use_all_keys", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == false); - row = uiLayoutRow(col, false); - uiItemL(row, IFACE_("First Modifier:"), ICON_NONE); - uiItemR(row, ptr, "modifier_key_1", UI_ITEM_R_EVENT, "", ICON_NONE); - - row = uiLayoutRow(col, false); - uiItemL(row, IFACE_("Second Modifier:"), ICON_NONE); - uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", ICON_NONE); - - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - uiItemPointerR(layout, ptr, "log", &settings_ptr, "properties", NULL, ICON_NONE); - uiItemPointerR(layout, ptr, "target", &settings_ptr, "properties", NULL, ICON_NONE); -} - -static void draw_sensor_message(uiLayout *layout, PointerRNA *ptr) -{ - uiItemR(layout, ptr, "subject", 0, NULL, ICON_NONE); -} - -static void draw_sensor_mouse(uiLayout *layout, PointerRNA *ptr, bContext *C) -{ - uiLayout *split, *split2; - PointerRNA main_ptr; - - split = uiLayoutSplit(layout, 0.8f, false); - uiItemR(split, ptr, "mouse_event", 0, NULL, ICON_NONE); - - if (RNA_enum_get(ptr, "mouse_event") == BL_SENS_MOUSE_MOUSEOVER_ANY) { - uiItemR(split, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.3f, false); - uiItemR(split, ptr, "use_material", 0, "", ICON_NONE); - - split2 = uiLayoutSplit(split, 0.7f, false); - if (RNA_enum_get(ptr, "use_material") == SENS_RAY_PROPERTY) { - uiItemR(split2, ptr, "property", 0, "", ICON_NONE); - } - else { - RNA_main_pointer_create(CTX_data_main(C), &main_ptr); - uiItemPointerR(split2, ptr, "material", &main_ptr, "materials", "", ICON_MATERIAL_DATA); - } - uiItemR(split2, ptr, "use_x_ray", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - } -} - -static void draw_sensor_near(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *row; - - uiItemR(layout, ptr, "property", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "reset_distance", 0, NULL, ICON_NONE); -} - -static void draw_sensor_property(uiLayout *layout, PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->id.data; - PointerRNA settings_ptr; - - uiLayout *row; - uiItemR(layout, ptr, "evaluation_type", 0, NULL, ICON_NONE); - - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE); - - switch (RNA_enum_get(ptr, "evaluation_type")) { - case SENS_PROP_INTERVAL: - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "value_min", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "value_max", 0, NULL, ICON_NONE); - break; - case SENS_PROP_EQUAL: - case SENS_PROP_NEQUAL: - case SENS_PROP_LESSTHAN: - case SENS_PROP_GREATERTHAN: - uiItemR(layout, ptr, "value", 0, NULL, ICON_NONE); - break; - case SENS_PROP_CHANGED: - break; - } -} - -static void draw_sensor_radar(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *row; - - uiItemR(layout, ptr, "property", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "axis", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "angle", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE); -} - -static void draw_sensor_random(uiLayout *layout, PointerRNA *ptr) -{ - uiItemR(layout, ptr, "seed", 0, NULL, ICON_NONE); -} - -static void draw_sensor_ray(uiLayout *layout, PointerRNA *ptr, bContext *C) -{ - uiLayout *split, *row; - PointerRNA main_ptr; - - RNA_main_pointer_create(CTX_data_main(C), &main_ptr); - split = uiLayoutSplit(layout, 0.3f, false); - uiItemR(split, ptr, "ray_type", 0, "", ICON_NONE); - switch (RNA_enum_get(ptr, "ray_type")) { - case SENS_RAY_PROPERTY: - uiItemR(split, ptr, "property", 0, "", ICON_NONE); - break; - case SENS_RAY_MATERIAL: - uiItemPointerR(split, ptr, "material", &main_ptr, "materials", "", ICON_MATERIAL_DATA); - break; - } - - split = uiLayoutSplit(layout, 0.3, false); - uiItemR(split, ptr, "axis", 0, "", ICON_NONE); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "range", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "use_x_ray", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); -} - -static void draw_brick_sensor(uiLayout *layout, PointerRNA *ptr, bContext *C) -{ - uiLayout *box; - - if (!RNA_boolean_get(ptr, "show_expanded")) - return; - - draw_sensor_internal_header(layout, ptr); - - box = uiLayoutBox(layout); - uiLayoutSetActive(box, RNA_boolean_get(ptr, "active")); - - switch (RNA_enum_get(ptr, "type")) { - - case SENS_ACTUATOR: - draw_sensor_actuator(box, ptr); - break; - case SENS_ALWAYS: - break; - case SENS_ARMATURE: - draw_sensor_armature(box, ptr); - break; - case SENS_COLLISION: - draw_sensor_collision(box, ptr, C); - break; - case SENS_DELAY: - draw_sensor_delay(box, ptr); - break; - case SENS_JOYSTICK: - draw_sensor_joystick(box, ptr); - break; - case SENS_KEYBOARD: - draw_sensor_keyboard(box, ptr); - break; - case SENS_MESSAGE: - draw_sensor_message(box, ptr); - break; - case SENS_MOUSE: - draw_sensor_mouse(box, ptr, C); - break; - case SENS_NEAR: - draw_sensor_near(box, ptr); - break; - case SENS_PROPERTY: - draw_sensor_property(box, ptr); - break; - case SENS_RADAR: - draw_sensor_radar(box, ptr); - break; - case SENS_RANDOM: - draw_sensor_random(box, ptr); - break; - case SENS_RAY: - draw_sensor_ray(box, ptr, C); - break; - } -} - -/* Controller code */ -static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, int width, int yco) -{ - uiLayout *box, *row, *sub; - bController *cont= (bController *)ptr->data; - - char state[3]; - BLI_snprintf(state, sizeof(state), "%d", RNA_int_get(ptr, "states")); - - box = uiLayoutBox(layout); - row = uiLayoutRow(box, false); - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemR(sub, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE); - if (RNA_boolean_get(ptr, "show_expanded")) { - uiItemR(sub, ptr, "type", 0, "", ICON_NONE); - uiItemR(sub, ptr, "name", 0, "", ICON_NONE); - /* XXX provisory for Blender 2.50Beta */ - uiDefBlockBut(uiLayoutGetBlock(layout), controller_state_mask_menu, cont, state, (short)(xco+width-44), yco, 22+22, UI_UNIT_Y, IFACE_("Set controller state index (from 1 to 30)")); - } - else { - uiItemL(sub, IFACE_(controller_name(cont->type)), ICON_NONE); - uiItemL(sub, cont->name, ICON_NONE); - uiItemL(sub, state, ICON_NONE); - } - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemR(sub, ptr, "use_priority", 0, "", ICON_NONE); - - if (RNA_boolean_get(ptr, "show_expanded")==0) { - sub = uiLayoutRow(row, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up - uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down - } - - sub = uiLayoutRow(row, false); - uiItemR(sub, ptr, "active", 0, "", ICON_NONE); - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemO(sub, "", ICON_X, "LOGIC_OT_controller_remove"); -} - -static void draw_controller_expression(uiLayout *layout, PointerRNA *ptr) -{ - uiItemR(layout, ptr, "expression", 0, "", ICON_NONE); -} - -static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *split, *sub; - - split = uiLayoutSplit(layout, 0.3, true); - uiItemR(split, ptr, "mode", 0, "", ICON_NONE); - if (RNA_enum_get(ptr, "mode") == CONT_PY_SCRIPT) { - uiItemR(split, ptr, "text", 0, "", ICON_NONE); - } - else { - sub = uiLayoutSplit(split, 0.8f, false); - uiItemR(sub, ptr, "module", 0, "", ICON_NONE); - uiItemR(sub, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - } -} - -static void draw_controller_state(uiLayout *UNUSED(layout), PointerRNA *UNUSED(ptr)) -{ - -} - -static void draw_brick_controller(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *box; - - if (!RNA_boolean_get(ptr, "show_expanded")) - return; - - box = uiLayoutBox(layout); - uiLayoutSetActive(box, RNA_boolean_get(ptr, "active")); - - draw_controller_state(box, ptr); - - switch (RNA_enum_get(ptr, "type")) { - case CONT_LOGIC_AND: - break; - case CONT_LOGIC_OR: - break; - case CONT_EXPRESSION: - draw_controller_expression(box, ptr); - break; - case CONT_PYTHON: - draw_controller_python(box, ptr); - break; - case CONT_LOGIC_NAND: - break; - case CONT_LOGIC_NOR: - break; - case CONT_LOGIC_XOR: - break; - case CONT_LOGIC_XNOR: - break; - } -} - -/* Actuator code */ -static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *logic_ptr) -{ - uiLayout *box, *row, *sub; - bActuator *act= (bActuator *)ptr->data; - - box = uiLayoutBox(layout); - row = uiLayoutRow(box, false); - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemR(sub, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE); - if (RNA_boolean_get(ptr, "show_expanded")) { - uiItemR(sub, ptr, "type", 0, "", ICON_NONE); - uiItemR(sub, ptr, "name", 0, "", ICON_NONE); - } - else { - uiItemL(sub, IFACE_(actuator_name(act->type)), ICON_NONE); - uiItemL(sub, act->name, ICON_NONE); - } - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, (((RNA_boolean_get(logic_ptr, "show_actuators_active_states") && - RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")) && - RNA_boolean_get(ptr, "active"))); - uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE); - - if (RNA_boolean_get(ptr, "show_expanded")==0) { - sub = uiLayoutRow(row, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up - uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down - } - - sub = uiLayoutRow(row, false); - uiItemR(sub, ptr, "active", 0, "", ICON_NONE); - - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "active")); - uiItemO(sub, "", ICON_X, "LOGIC_OT_actuator_remove"); -} - -static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->id.data; - PointerRNA settings_ptr; - uiLayout *row, *sub; - - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "play_mode", 0, "", ICON_NONE); - - sub = uiLayoutRow(row, true); - uiItemR(sub, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(sub, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - row = uiLayoutColumn(sub, false); - uiLayoutSetActive(row, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force"))); - uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "action", 0, "", ICON_NONE); - uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - if ((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP)) - uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE); - - else { - uiItemR(row, ptr, "frame_start", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "frame_end", 0, NULL, ICON_NONE); - } - - uiItemR(row, ptr, "apply_to_children", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "priority", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "layer", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "layer_weight", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "blend_mode", 0, "", ICON_NONE); - - uiItemPointerR(layout, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE); - -#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR - uiItemR(layout, "stride_length", 0, NULL, ICON_NONE); -#endif -} - -static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) -{ - bActuator *act = (bActuator *)ptr->data; - bArmatureActuator *aa = (bArmatureActuator *) act->data; - Object *ob = (Object *)ptr->id.data; - bConstraint *constraint = NULL; - PointerRNA pose_ptr, pchan_ptr; - PropertyRNA *bones_prop = NULL; - - if (ob->type != OB_ARMATURE) { - uiItemL(layout, IFACE_("Actuator only available for armatures"), ICON_NONE); - return; - } - - if (ob->pose) { - RNA_pointer_create((ID *)ob, &RNA_Pose, ob->pose, &pose_ptr); - bones_prop = RNA_struct_find_property(&pose_ptr, "bones"); - } - - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - - switch (RNA_enum_get(ptr, "mode")) { - case ACT_ARM_RUN: - break; - case ACT_ARM_ENABLE: - case ACT_ARM_DISABLE: - if (ob->pose) { - uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); - - if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) - uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); - } - break; - case ACT_ARM_SETTARGET: - if (ob->pose) { - uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); - - if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) - uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); - } - - uiItemR(layout, ptr, "target", 0, NULL, ICON_NONE); - - /* show second target only if the constraint supports it */ - get_armature_bone_constraint(ob, aa->posechannel, aa->constraint, &constraint); - if (constraint && constraint->type == CONSTRAINT_TYPE_KINEMATIC) { - uiItemR(layout, ptr, "secondary_target", 0, NULL, ICON_NONE); - } - break; - case ACT_ARM_SETWEIGHT: - if (ob->pose) { - uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); - - if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) - uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); - } - - uiItemR(layout, ptr, "weight", 0, NULL, ICON_NONE); - break; - case ACT_ARM_SETINFLUENCE: - if (ob->pose) { - uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA); - - if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr)) - uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE); - } - - uiItemR(layout, ptr, "influence", 0, NULL, ICON_NONE); - break; - } -} - -static void draw_actuator_camera(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *row; - uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "height", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "axis", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "min", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "max", 0, NULL, ICON_NONE); - - uiItemR(layout, ptr, "damping", 0, NULL, ICON_NONE); -} - -static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext *C) -{ - uiLayout *row, *col, *sub, *split; - PointerRNA main_ptr; - - RNA_main_pointer_create(CTX_data_main(C), &main_ptr); - - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - switch (RNA_enum_get(ptr, "mode")) { - case ACT_CONST_TYPE_LOC: - uiItemR(layout, ptr, "limit", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "limit_min", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "limit_max", 0, NULL, ICON_NONE); - - uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - break; - - case ACT_CONST_TYPE_DIST: - split = uiLayoutSplit(layout, 0.8, false); - uiItemR(split, ptr, "direction", 0, NULL, ICON_NONE); - row = uiLayoutRow(split, true); - uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(row, ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - col = uiLayoutColumn(row, true); - uiItemL(col, IFACE_("Range:"), ICON_NONE); - uiItemR(col, ptr, "range", 0, "", ICON_NONE); - - col = uiLayoutColumn(row, true); - uiItemR(col, ptr, "use_force_distance", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - sub = uiLayoutColumn(col, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance") == true); - uiItemR(sub, ptr, "distance", 0, "", ICON_NONE); - - uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.15f, false); - uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - if (RNA_boolean_get(ptr, "use_material_detect")) - uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA); - else - uiItemR(split, ptr, "property", 0, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.15, false); - uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - row = uiLayoutRow(split, true); - uiItemR(row, ptr, "time", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - break; - - case ACT_CONST_TYPE_ORI: - uiItemR(layout, ptr, "direction_axis_pos", 0, NULL, ICON_NONE); - - row=uiLayoutRow(layout, true); - uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "time", 0, NULL, ICON_NONE); - - row=uiLayoutRow(layout, false); - uiItemR(row, ptr, "rotation_max", 0, NULL, ICON_NONE); - - row=uiLayoutRow(layout, true); - uiItemR(row, ptr, "angle_min", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "angle_max", 0, NULL, ICON_NONE); - break; - - case ACT_CONST_TYPE_FH: - split = uiLayoutSplit(layout, 0.75, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - - uiItemR(row, ptr, "fh_height", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "direction_axis", 0, NULL, ICON_NONE); - split = uiLayoutSplit(row, 0.9f, false); - uiItemR(split, ptr, "fh_force", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.15, false); - uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - if (RNA_boolean_get(ptr, "use_material_detect")) - uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA); - else - uiItemR(split, ptr, "property", 0, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.15, false); - uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "time", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - break; - } -} - -static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->id.data; - uiLayout *row, *split, *sub; - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - - switch (RNA_enum_get(ptr, "mode")) { - case ACT_EDOB_ADD_OBJECT: - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "object", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "time", 0, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - break; - case ACT_EDOB_END_OBJECT: - break; - case ACT_EDOB_REPLACE_MESH: - if (ob->type != OB_MESH) { - uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE); - break; - } - split = uiLayoutSplit(layout, 0.6, false); - uiItemR(split, ptr, "mesh", 0, NULL, ICON_NONE); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "use_replace_display_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(row, ptr, "use_replace_physics_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - break; - case ACT_EDOB_TRACK_TO: - split = uiLayoutSplit(layout, 0.5, false); - uiItemR(split, ptr, "track_object", 0, NULL, ICON_NONE); - sub = uiLayoutSplit(split, 0.7f, false); - uiItemR(sub, ptr, "time", 0, NULL, ICON_NONE); - uiItemR(sub, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "up_axis", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "track_axis", 0, NULL, ICON_NONE); - break; - case ACT_EDOB_DYNAMICS: - if (ob->type != OB_MESH) { - uiItemL(layout, IFACE_("Mode only available for mesh objects"), ICON_NONE); - break; - } - uiItemR(layout, ptr, "dynamic_operation", 0, NULL, ICON_NONE); - if (RNA_enum_get(ptr, "dynamic_operation") == ACT_EDOB_SET_MASS) - uiItemR(layout, ptr, "mass", 0, NULL, ICON_NONE); - break; - } -} - -static void draw_actuator_filter_2d(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *row, *split; - - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - switch (RNA_enum_get(ptr, "mode")) { - case ACT_2DFILTER_CUSTOMFILTER: - uiItemR(layout, ptr, "filter_pass", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "glsl_shader", 0, NULL, ICON_NONE); - break; - case ACT_2DFILTER_MOTIONBLUR: - split=uiLayoutSplit(layout, 0.75f, true); - row = uiLayoutRow(split, false); - uiLayoutSetActive(row, RNA_boolean_get(ptr, "use_motion_blur") == true); - uiItemR(row, ptr, "motion_blur_factor", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_motion_blur", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - break; - default: // all other 2D Filters - uiItemR(layout, ptr, "filter_pass", 0, NULL, ICON_NONE); - break; - } -} - -static void draw_actuator_game(uiLayout *layout, PointerRNA *ptr) -{ - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - if (ELEM(RNA_enum_get(ptr, "mode"), ACT_GAME_LOAD, ACT_GAME_SCREENSHOT)) - uiItemR(layout, ptr, "filename", 0, NULL, ICON_NONE); -} - -static void draw_actuator_message(uiLayout *layout, PointerRNA *ptr, bContext *C) -{ - Object *ob; - PointerRNA main_ptr, settings_ptr; - uiLayout *row; - - RNA_main_pointer_create(CTX_data_main(C), &main_ptr); - - ob = (Object *)ptr->id.data; - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - - uiItemPointerR(layout, ptr, "to_property", &main_ptr, "objects", NULL, ICON_OBJECT_DATA); - uiItemR(layout, ptr, "subject", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "body_type", 0, NULL, ICON_NONE); - - if (RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG) - uiItemR(row, ptr, "body_message", 0, "", ICON_NONE); - else // mode == ACT_MESG_PROP - uiItemPointerR(row, ptr, "body_property", &settings_ptr, "properties", "", ICON_NONE); -} - -static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr) -{ - Object *ob; - PointerRNA settings_ptr; - uiLayout *split, *row, *col, *sub; - int physics_type; - - ob = (Object *)ptr->id.data; - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - physics_type = RNA_enum_get(&settings_ptr, "physics_type"); - - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - - switch (RNA_enum_get(ptr, "mode")) { - case ACT_OBJECT_NORMAL: - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - if (ELEM(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) { - uiItemL(layout, IFACE_("Dynamic Object Settings:"), ICON_NONE); - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "force", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_local_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "torque", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_local_torque", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE); - row = uiLayoutRow(split, true); - uiItemR(row, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(row, ptr, "use_add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - uiItemR(layout, ptr, "damping", 0, NULL, ICON_NONE); - } - break; - case ACT_OBJECT_SERVO: - uiItemR(layout, ptr, "reference_object", 0, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - col = uiLayoutColumn(row, false); - uiItemR(col, ptr, "use_servo_limit_x", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - sub = uiLayoutColumn(col, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_x") == true); - uiItemR(sub, ptr, "force_max_x", 0, NULL, ICON_NONE); - uiItemR(sub, ptr, "force_min_x", 0, NULL, ICON_NONE); - - col = uiLayoutColumn(row, false); - uiItemR(col, ptr, "use_servo_limit_y", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - sub = uiLayoutColumn(col, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_y") == true); - uiItemR(sub, ptr, "force_max_y", 0, NULL, ICON_NONE); - uiItemR(sub, ptr, "force_min_y", 0, NULL, ICON_NONE); - - col = uiLayoutColumn(row, false); - uiItemR(col, ptr, "use_servo_limit_z", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - sub = uiLayoutColumn(col, true); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_z") == true); - uiItemR(sub, ptr, "force_max_z", 0, NULL, ICON_NONE); - uiItemR(sub, ptr, "force_min_z", 0, NULL, ICON_NONE); - - //XXXACTUATOR missing labels from original 2.49 ui (e.g. Servo, Min, Max, Fast) - //Layout designers willing to help on that, please compare with 2.49 ui - // (since the old code is going to be deleted ... soon) - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "proportional_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "integral_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "derivate_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - break; - case ACT_OBJECT_CHARACTER: - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NONE); - row = uiLayoutRow(split, true); - uiItemR(row, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(row, ptr, "use_add_character_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE); - uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - - split = uiLayoutSplit(layout, 0.9, false); - row = uiLayoutRow(split, false); - split = uiLayoutSplit(row, 0.7, false); - uiItemL(split, "", ICON_NONE); /*Just use this for some spacing */ - uiItemR(split, ptr, "use_character_jump", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - break; - } -} - -static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *row, *sub; - - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - - if (RNA_enum_get(ptr, "mode") == ACT_PARENT_SET) { - uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "use_compound", 0, NULL, ICON_NONE); - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_compound") == true); - uiItemR(sub, ptr, "use_ghost", 0, NULL, ICON_NONE); - } -} - -static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->id.data; - bActuator *act = (bActuator *)ptr->data; - bPropertyActuator *pa = (bPropertyActuator *) act->data; - Object *ob_from= pa->ob; - PointerRNA settings_ptr, obj_settings_ptr; - - uiLayout *row, *sub; - - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE); - - switch (RNA_enum_get(ptr, "mode")) { - case ACT_PROP_TOGGLE: - case ACT_PROP_LEVEL: - break; - case ACT_PROP_ADD: - uiItemR(layout, ptr, "value", 0, NULL, ICON_NONE); - break; - case ACT_PROP_ASSIGN: - uiItemR(layout, ptr, "value", 0, NULL, ICON_NONE); - break; - case ACT_PROP_COPY: - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "object", 0, NULL, ICON_NONE); - if (ob_from) { - RNA_pointer_create((ID *)ob_from, &RNA_GameObjectSettings, ob_from, &obj_settings_ptr); - uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NONE); - } - else { - sub = uiLayoutRow(row, false); - uiLayoutSetActive(sub, false); - uiItemR(sub, ptr, "object_property", 0, NULL, ICON_NONE); - } - break; - } -} - -static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr) -{ - Object *ob; - PointerRNA settings_ptr; - uiLayout *row; - - ob = (Object *)ptr->id.data; - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - - row = uiLayoutRow(layout, false); - - uiItemR(row, ptr, "seed", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "distribution", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - - switch (RNA_enum_get(ptr, "distribution")) { - case ACT_RANDOM_BOOL_CONST: - uiItemR(row, ptr, "use_always_true", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - break; - - case ACT_RANDOM_BOOL_UNIFORM: - uiItemL(row, IFACE_("Choose between true and false, 50% chance each"), ICON_NONE); - break; - - case ACT_RANDOM_BOOL_BERNOUILLI: - uiItemR(row, ptr, "chance", 0, NULL, ICON_NONE); - break; - - case ACT_RANDOM_INT_CONST: - uiItemR(row, ptr, "int_value", 0, NULL, ICON_NONE); - break; - - case ACT_RANDOM_INT_UNIFORM: - uiItemR(row, ptr, "int_min", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "int_max", 0, NULL, ICON_NONE); - break; - - case ACT_RANDOM_INT_POISSON: - uiItemR(row, ptr, "int_mean", 0, NULL, ICON_NONE); - break; - - case ACT_RANDOM_FLOAT_CONST: - uiItemR(row, ptr, "float_value", 0, NULL, ICON_NONE); - break; - - case ACT_RANDOM_FLOAT_UNIFORM: - uiItemR(row, ptr, "float_min", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "float_max", 0, NULL, ICON_NONE); - break; - - case ACT_RANDOM_FLOAT_NORMAL: - uiItemR(row, ptr, "float_mean", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "standard_derivation", 0, NULL, ICON_NONE); - break; - - case ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL: - uiItemR(row, ptr, "half_life_time", 0, NULL, ICON_NONE); - break; - } -} - -static void draw_actuator_scene(uiLayout *layout, PointerRNA *ptr) -{ - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - - switch (RNA_enum_get(ptr, "mode")) { - case ACT_SCENE_CAMERA: - uiItemR(layout, ptr, "camera", 0, NULL, ICON_NONE); - break; - case ACT_SCENE_RESTART: - break; - default: // ACT_SCENE_SET|ACT_SCENE_ADD_FRONT|ACT_SCENE_ADD_BACK|ACT_SCENE_REMOVE|ACT_SCENE_SUSPEND|ACT_SCENE_RESUME - uiItemR(layout, ptr, "scene", 0, NULL, ICON_NONE); - break; - } -} - -static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->id.data; - PointerRNA settings_ptr; - uiLayout *row; - - if (ob->type != OB_MESH) { - uiItemL(layout, IFACE_("Actuator only available for mesh objects"), ICON_NONE); - return; - } - - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "mode", 0, "", ICON_NONE); - uiItemR(row, ptr, "action", 0, "", ICON_NONE); - uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - if ((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP)) - uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE); - - else { - uiItemR(row, ptr, "frame_start", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "frame_end", 0, NULL, ICON_NONE); - } - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "priority", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE); - -#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR - uiItemR(row, "stride_length", 0, NULL, ICON_NONE); -#endif -} - -static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C) -{ - uiLayout *row, *col; - - uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL); - if (!RNA_pointer_get(ptr, "sound").data) { - uiItemL(layout, IFACE_("Select a sound from the list or load a new one"), ICON_NONE); - return; - } - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "volume", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "pitch", 0, NULL, ICON_NONE); - - uiItemR(layout, ptr, "use_sound_3d", 0, NULL, ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_sound_3d") == true); - - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "gain_3d_min", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "gain_3d_max", 0, NULL, ICON_NONE); - - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "distance_3d_reference", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "distance_3d_max", 0, NULL, ICON_NONE); - - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "rolloff_factor_3d", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "cone_outer_gain_3d", 0, NULL, ICON_NONE); - - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "cone_outer_angle_3d", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "cone_inner_angle_3d", 0, NULL, ICON_NONE); -} - -static void draw_actuator_state(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *split; - Object *ob = (Object *)ptr->id.data; - PointerRNA settings_ptr; - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - - split = uiLayoutSplit(layout, 0.35, false); - uiItemR(split, ptr, "operation", 0, NULL, ICON_NONE); - - uiTemplateLayers(split, ptr, "states", &settings_ptr, "used_states", 0); -} - -static void draw_actuator_visibility(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *row; - row = uiLayoutRow(layout, false); - - uiItemR(row, ptr, "use_visible", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "use_occlusion", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "apply_to_children", 0, NULL, ICON_NONE); -} - -static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *row; - uiLayout *col; - - uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "target", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "navmesh", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "velocity", 0, NULL, ICON_NONE); - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "acceleration", 0, NULL, ICON_NONE); - uiItemR(row, ptr, "turn_speed", 0, NULL, ICON_NONE); - - row = uiLayoutRow(layout, false); - col = uiLayoutColumn(row, false); - uiItemR(col, ptr, "facing", 0, NULL, ICON_NONE); - col = uiLayoutColumn(row, false); - uiItemR(col, ptr, "facing_axis", 0, NULL, ICON_NONE); - if (!RNA_boolean_get(ptr, "facing")) { - uiLayoutSetActive(col, false); - } - col = uiLayoutColumn(row, false); - uiItemR(col, ptr, "normal_up", 0, NULL, ICON_NONE); - if (!RNA_pointer_get(ptr, "navmesh").data) { - uiLayoutSetActive(col, false); - } - - row = uiLayoutRow(layout, false); - col = uiLayoutColumn(row, false); - uiItemR(col, ptr, "self_terminated", 0, NULL, ICON_NONE); - if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) { - col = uiLayoutColumn(row, false); - uiItemR(col, ptr, "update_period", 0, NULL, ICON_NONE); - } - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "lock_z_velocity", 1, NULL, ICON_NONE); - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "show_visualization", 0, NULL, ICON_NONE); - if (RNA_enum_get(ptr, "mode") != ACT_STEERING_PATHFOLLOWING) { - uiLayoutSetActive(row, false); - } -} - -static void draw_actuator_mouse(uiLayout *layout, PointerRNA *ptr) -{ - uiLayout *row, *col, *subcol, *split, *subsplit; - - uiItemR(layout, ptr, "mode", 0, NULL, 0); - - switch (RNA_enum_get(ptr, "mode")) { - case ACT_MOUSE_VISIBILITY: - row = uiLayoutRow(layout, 0); - uiItemR(row, ptr, "visible", UI_ITEM_R_TOGGLE, NULL, 0); - break; - - case ACT_MOUSE_LOOK: - /* X axis */ - row = uiLayoutRow(layout, 0); - col = uiLayoutColumn(row, 1); - - uiItemR(col, ptr, "use_axis_x", UI_ITEM_R_TOGGLE, NULL, 0); - - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_axis_x")==1); - uiItemR(subcol, ptr, "sensitivity_x", 0, NULL, 0); - uiItemR(subcol, ptr, "threshold_x", 0, NULL, 0); - - uiItemR(subcol, ptr, "min_x", 0, NULL, 0); - uiItemR(subcol, ptr, "max_x", 0, NULL, 0); - - uiItemR(subcol, ptr, "object_axis_x", 0, NULL, 0); - - /* Y Axis */ - col = uiLayoutColumn(row, 1); - - uiItemR(col, ptr, "use_axis_y", UI_ITEM_R_TOGGLE, NULL, 0); - - subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(ptr, "use_axis_y")==1); - uiItemR(subcol, ptr, "sensitivity_y", 0, NULL, 0); - uiItemR(subcol, ptr, "threshold_y", 0, NULL, 0); - - uiItemR(subcol, ptr, "min_y", 0, NULL, 0); - uiItemR(subcol, ptr, "max_y", 0, NULL, 0); - - uiItemR(subcol, ptr, "object_axis_y", 0, NULL, 0); - - /* Lower options */ - row = uiLayoutRow(layout, 0); - split = uiLayoutSplit(row, 0.5, 0); - - subsplit = uiLayoutSplit(split, 0.5, 1); - uiLayoutSetActive(subsplit, RNA_boolean_get(ptr, "use_axis_x")==1); - uiItemR(subsplit, ptr, "local_x", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(subsplit, ptr, "reset_x", UI_ITEM_R_TOGGLE, NULL, 0); - - subsplit = uiLayoutSplit(split, 0.5, 1); - uiLayoutSetActive(subsplit, RNA_boolean_get(ptr, "use_axis_y")==1); - uiItemR(subsplit, ptr, "local_y", UI_ITEM_R_TOGGLE, NULL, 0); - uiItemR(subsplit, ptr, "reset_y", UI_ITEM_R_TOGGLE, NULL, 0); - - break; - } -} - -static void draw_brick_actuator(uiLayout *layout, PointerRNA *ptr, bContext *C) -{ - uiLayout *box; - - if (!RNA_boolean_get(ptr, "show_expanded")) - return; - - box = uiLayoutBox(layout); - uiLayoutSetActive(box, RNA_boolean_get(ptr, "active")); - - switch (RNA_enum_get(ptr, "type")) { - case ACT_ACTION: - draw_actuator_action(box, ptr); - break; - case ACT_ARMATURE: - draw_actuator_armature(box, ptr); - break; - case ACT_CAMERA: - draw_actuator_camera(box, ptr); - break; - case ACT_CONSTRAINT: - draw_actuator_constraint(box, ptr, C); - break; - case ACT_EDIT_OBJECT: - draw_actuator_edit_object(box, ptr); - break; - case ACT_2DFILTER: - draw_actuator_filter_2d(box, ptr); - break; - case ACT_GAME: - draw_actuator_game(box, ptr); - break; - case ACT_MESSAGE: - draw_actuator_message(box, ptr, C); - break; - case ACT_OBJECT: - draw_actuator_motion(box, ptr); - break; - case ACT_PARENT: - draw_actuator_parent(box, ptr); - break; - case ACT_PROPERTY: - draw_actuator_property(box, ptr); - break; - case ACT_RANDOM: - draw_actuator_random(box, ptr); - break; - case ACT_SCENE: - draw_actuator_scene(box, ptr); - break; - case ACT_SHAPEACTION: - draw_actuator_shape_action(box, ptr); - break; - case ACT_SOUND: - draw_actuator_sound(box, ptr, C); - break; - case ACT_STATE: - draw_actuator_state(box, ptr); - break; - case ACT_VISIBILITY: - draw_actuator_visibility(box, ptr); - break; - case ACT_STEERING: - draw_actuator_steering(box, ptr); - break; - case ACT_MOUSE: - draw_actuator_mouse(box, ptr); - break; - } -} - -void logic_buttons(bContext *C, ARegion *ar) -{ - SpaceLogic *slogic= CTX_wm_space_logic(C); - Object *ob= CTX_data_active_object(C); - ID **idar; - PointerRNA logic_ptr, settings_ptr, object_ptr; - uiLayout *layout, *row, *box; - uiBlock *block; - uiBut *but; - char uiblockstr[32]; - short a, count; - int xco, yco, width, height; - - if (ob==NULL) return; - - RNA_pointer_create(NULL, &RNA_SpaceLogicEditor, slogic, &logic_ptr); - idar= get_selected_and_linked_obs(C, &count, slogic->scaflag); - - BLI_snprintf(uiblockstr, sizeof(uiblockstr), "buttonswin %p", (void *)ar); - block= UI_block_begin(C, ar, uiblockstr, UI_EMBOSS); - UI_block_func_handle_set(block, do_logic_buts, NULL); - UI_block_bounds_set_normal(block, U.widget_unit/2); - - /* loop over all objects and set visible/linked flags for the logic bricks */ - for (a=0; a<count; a++) { - bActuator *act; - bSensor *sens; - bController *cont; - int iact; - short flag; - - ob= (Object *)idar[a]; - - /* clean ACT_LINKED and ACT_VISIBLE of all potentially visible actuators so that we can determine which is actually linked/visible */ - act = ob->actuators.first; - while (act) { - act->flag &= ~(ACT_LINKED|ACT_VISIBLE); - act = act->next; - } - /* same for sensors */ - sens= ob->sensors.first; - while (sens) { - sens->flag &= ~(SENS_VISIBLE); - sens = sens->next; - } - - /* mark the linked and visible actuators */ - cont= ob->controllers.first; - while (cont) { - flag = ACT_LINKED; - - /* this controller is visible, mark all its actuator */ - if ((ob->scaflag & OB_ALLSTATE) || (ob->state & cont->state_mask)) - flag |= ACT_VISIBLE; - - for (iact=0; iact<cont->totlinks; iact++) { - act = cont->links[iact]; - if (act) - act->flag |= flag; - } - cont = cont->next; - } - } - - /* ****************** Controllers ****************** */ - - xco= 21 * U.widget_unit; yco= - U.widget_unit / 2; width= 15 * U.widget_unit; - layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get()); - row = uiLayoutRow(layout, true); - - uiDefBlockBut(block, controller_menu, NULL, IFACE_("Controllers"), xco - U.widget_unit / 2, yco, width, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ - - uiItemR(row, &logic_ptr, "show_controllers_selected_objects", 0, IFACE_("Sel"), ICON_NONE); - uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, IFACE_("Act"), ICON_NONE); - uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, IFACE_("Link"), ICON_NONE); - - for (a=0; a<count; a++) { - bController *cont; - PointerRNA ptr; - uiLayout *split, *subsplit, *col; - - - ob= (Object *)idar[a]; - - /* only draw the controller common header if "use_visible" */ - if ( (ob->scavisflag & OB_VIS_CONT) == 0) { - continue; - } - - /* Drawing the Controller Header common to all Selected Objects */ - - RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr); - - split = uiLayoutSplit(layout, 0.05f, false); - uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT); - - row = uiLayoutRow(split, true); - uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWCONT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide controllers")); - - RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); - uiLayoutSetContextPointer(row, "object", &object_ptr); - uiItemMenuEnumO(row, C, "LOGIC_OT_controller_add", "type", IFACE_("Add Controller"), ICON_NONE); - - if (RNA_boolean_get(&settings_ptr, "show_state_panel")) { - - box = uiLayoutBox(layout); - split = uiLayoutSplit(box, 0.2f, false); - - col = uiLayoutColumn(split, false); - uiItemL(col, IFACE_("Visible"), ICON_NONE); - uiItemL(col, IFACE_("Initial"), ICON_NONE); - - subsplit = uiLayoutSplit(split, 0.85f, false); - col = uiLayoutColumn(subsplit, false); - row = uiLayoutRow(col, false); - uiLayoutSetActive(row, RNA_boolean_get(&settings_ptr, "use_all_states") == false); - uiTemplateGameStates(row, &settings_ptr, "states_visible", &settings_ptr, "used_states", 0); - row = uiLayoutRow(col, false); - uiTemplateGameStates(row, &settings_ptr, "states_initial", &settings_ptr, "used_states", 0); - - col = uiLayoutColumn(subsplit, false); - uiItemR(col, &settings_ptr, "use_all_states", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(col, &settings_ptr, "show_debug_state", 0, "", ICON_NONE); - } - - /* End of Drawing the Controller Header common to all Selected Objects */ - - if ((ob->scaflag & OB_SHOWCONT) == 0) continue; - - - uiItemS(layout); - - for (cont= ob->controllers.first; cont; cont=cont->next) { - RNA_pointer_create((ID *)ob, &RNA_Controller, cont, &ptr); - - if (!(ob->scaflag & OB_ALLSTATE) && !(ob->state & cont->state_mask)) - continue; - - /* use two nested splits to align inlinks/links properly */ - split = uiLayoutSplit(layout, 0.05f, false); - - /* put inlink button to the left */ - col = uiLayoutColumn(split, false); - uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); - uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT); - but = uiDefIconBut(block, UI_BTYPE_INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, ""); - if (!RNA_boolean_get(&ptr, "active")) { - UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); - } - - //col = uiLayoutColumn(split, true); - /* nested split for middle and right columns */ - subsplit = uiLayoutSplit(split, 0.95f, false); - - col = uiLayoutColumn(subsplit, true); - uiLayoutSetContextPointer(col, "controller", &ptr); - - /* should make UI template for controller header.. function will do for now */ -// draw_controller_header(col, &ptr); - draw_controller_header(col, &ptr, xco, width, yco); //provisory for 2.50 beta - - /* draw the brick contents */ - draw_brick_controller(col, &ptr); - - /* put link button to the right */ - col = uiLayoutColumn(subsplit, false); - uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); - uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT); - but = uiDefIconBut(block, UI_BTYPE_LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - if (!RNA_boolean_get(&ptr, "active")) { - UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); - } - - UI_but_link_set(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR); - - } - } - UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */ - height = yco; - - /* ****************** Sensors ****************** */ - - xco= U.widget_unit / 2; yco= -U.widget_unit / 2; width= 17 * U.widget_unit; - layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get()); - row = uiLayoutRow(layout, true); - - uiDefBlockBut(block, sensor_menu, NULL, IFACE_("Sensors"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ - - uiItemR(row, &logic_ptr, "show_sensors_selected_objects", 0, IFACE_("Sel"), ICON_NONE); - uiItemR(row, &logic_ptr, "show_sensors_active_object", 0, IFACE_("Act"), ICON_NONE); - uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, IFACE_("Link"), ICON_NONE); - uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, IFACE_("State"), ICON_NONE); - - for (a=0; a<count; a++) { - bSensor *sens; - PointerRNA ptr; - - ob= (Object *)idar[a]; - - /* only draw the sensor common header if "use_visible" */ - if ((ob->scavisflag & OB_VIS_SENS) == 0) continue; - - row = uiLayoutRow(layout, true); - uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWSENS, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide sensors")); - - RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); - uiLayoutSetContextPointer(row, "object", &object_ptr); - uiItemMenuEnumO(row, C, "LOGIC_OT_sensor_add", "type", IFACE_("Add Sensor"), ICON_NONE); - - if ((ob->scaflag & OB_SHOWSENS) == 0) continue; - - uiItemS(layout); - - for (sens= ob->sensors.first; sens; sens=sens->next) { - RNA_pointer_create((ID *)ob, &RNA_Sensor, sens, &ptr); - - if ((ob->scaflag & OB_ALLSTATE) || - !(slogic->scaflag & BUTS_SENS_STATE) || - (sens->totlinks == 0) || /* always display sensor without links so that is can be edited */ - (sens->flag & SENS_PIN && slogic->scaflag & BUTS_SENS_STATE) || /* states can hide some sensors, pinned sensors ignore the visible state */ - (is_sensor_linked(block, sens)) - ) - { // gotta check if the current state is visible or not - uiLayout *split, *col; - - /* make as visible, for move operator */ - sens->flag |= SENS_VISIBLE; - - split = uiLayoutSplit(layout, 0.95f, false); - col = uiLayoutColumn(split, true); - uiLayoutSetContextPointer(col, "sensor", &ptr); - - /* should make UI template for sensor header.. function will do for now */ - draw_sensor_header(col, &ptr, &logic_ptr); - - /* draw the brick contents */ - draw_brick_sensor(col, &ptr, C); - - /* put link button to the right */ - col = uiLayoutColumn(split, false); - uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); - but = uiDefIconBut(block, UI_BTYPE_LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - if (!RNA_boolean_get(&ptr, "active")) { - UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); - } - - /* use old-school uiButtons for links for now */ - UI_but_link_set(but, NULL, (void ***)&sens->links, &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER); - } - } - } - UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */ - height = MIN2(height, yco); - - /* ****************** Actuators ****************** */ - - xco= 40 * U.widget_unit; yco= -U.widget_unit / 2; width= 17 * U.widget_unit; - layout= UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, 0, UI_style_get()); - row = uiLayoutRow(layout, true); - - uiDefBlockBut(block, actuator_menu, NULL, IFACE_("Actuators"), xco - U.widget_unit / 2, yco, 15 * U.widget_unit, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */ - - uiItemR(row, &logic_ptr, "show_actuators_selected_objects", 0, IFACE_("Sel"), ICON_NONE); - uiItemR(row, &logic_ptr, "show_actuators_active_object", 0, IFACE_("Act"), ICON_NONE); - uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, IFACE_("Link"), ICON_NONE); - uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, IFACE_("State"), ICON_NONE); - - for (a=0; a<count; a++) { - bActuator *act; - PointerRNA ptr; - - ob= (Object *)idar[a]; - - /* only draw the actuator common header if "use_visible" */ - if ((ob->scavisflag & OB_VIS_ACT) == 0) { - continue; - } - - row = uiLayoutRow(layout, true); - uiDefButBitS(block, UI_BTYPE_TOGGLE, OB_SHOWACT, B_REDR, ob->id.name + 2, (short)(xco - U.widget_unit / 2), yco, (short)(width - 1.5f * U.widget_unit), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, TIP_("Object name, click to show/hide actuators")); - - RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); - uiLayoutSetContextPointer(row, "object", &object_ptr); - uiItemMenuEnumO(row, C, "LOGIC_OT_actuator_add", "type", IFACE_("Add Actuator"), ICON_NONE); - - if ((ob->scaflag & OB_SHOWACT) == 0) continue; - - uiItemS(layout); - - for (act= ob->actuators.first; act; act=act->next) { - - RNA_pointer_create((ID *)ob, &RNA_Actuator, act, &ptr); - - if ((ob->scaflag & OB_ALLSTATE) || - !(slogic->scaflag & BUTS_ACT_STATE) || - !(act->flag & ACT_LINKED) || /* always display actuators without links so that is can be edited */ - (act->flag & ACT_VISIBLE) || /* this actuator has visible connection, display it */ - (act->flag & ACT_PIN && slogic->scaflag & BUTS_ACT_STATE) /* states can hide some sensors, pinned sensors ignore the visible state */ - ) - { // gotta check if the current state is visible or not - uiLayout *split, *col; - - /* make as visible, for move operator */ - act->flag |= ACT_VISIBLE; - - split = uiLayoutSplit(layout, 0.05f, false); - - /* put inlink button to the left */ - col = uiLayoutColumn(split, false); - uiLayoutSetActive(col, RNA_boolean_get(&ptr, "active")); - but = uiDefIconBut(block, UI_BTYPE_INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, ""); - if (!RNA_boolean_get(&ptr, "active")) { - UI_but_flag_enable(but, UI_BUT_SCA_LINK_GREY); - } - - col = uiLayoutColumn(split, true); - uiLayoutSetContextPointer(col, "actuator", &ptr); - - /* should make UI template for actuator header.. function will do for now */ - draw_actuator_header(col, &ptr, &logic_ptr); - - /* draw the brick contents */ - draw_brick_actuator(col, &ptr, C); - - } - } - } - UI_block_layout_resolve(block, NULL, &yco); /* stores final height in yco */ - height = MIN2(height, yco); - - UI_view2d_totRect_set(&ar->v2d, 57.5f * U.widget_unit, height - U.widget_unit); - - /* set the view */ - UI_view2d_view_ortho(&ar->v2d); - - UI_block_links_compose(block); - - UI_block_end(C, block); - UI_block_draw(C, block); - - /* restore view matrix */ - UI_view2d_view_restore(C); - - if (idar) MEM_freeN(idar); -} - diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c deleted file mode 100644 index af90ef487e0..00000000000 --- a/source/blender/editors/space_logic/space_logic.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): Blender Foundation - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/editors/space_logic/space_logic.c - * \ingroup splogic - */ - - -#include <string.h> -#include <stdio.h> - - -#include "MEM_guardedalloc.h" - -#include "BLI_blenlib.h" -#include "BLI_utildefines.h" - -#include "DNA_gpencil_types.h" - -#include "BKE_context.h" -#include "BKE_library.h" -#include "BKE_screen.h" - -#include "ED_space_api.h" -#include "ED_screen.h" - -#include "BIF_gl.h" - - -#include "WM_api.h" -#include "WM_types.h" - -#include "UI_resources.h" -#include "UI_view2d.h" - -#include "logic_intern.h" - -/* ******************** manage regions ********************* */ - -ARegion *logic_has_buttons_region(ScrArea *sa) -{ - ARegion *ar, *arnew; - - ar = BKE_area_find_region_type(sa, RGN_TYPE_UI); - if (ar) return ar; - - /* add subdiv level; after header */ - ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); - - /* is error! */ - if (ar == NULL) return NULL; - - arnew= MEM_callocN(sizeof(ARegion), "buttons for image"); - - BLI_insertlinkafter(&sa->regionbase, ar, arnew); - arnew->regiontype = RGN_TYPE_UI; - arnew->alignment = RGN_ALIGN_RIGHT; - - arnew->flag = RGN_FLAG_HIDDEN; - - return arnew; -} - -/* ******************** default callbacks for image space ***************** */ - -static SpaceLink *logic_new(const bContext *C) -{ - ScrArea *sa= CTX_wm_area(C); - ARegion *ar; - SpaceLogic *slogic; - - slogic= MEM_callocN(sizeof(SpaceLogic), "initlogic"); - slogic->spacetype= SPACE_LOGIC; - - /* default options */ - slogic->scaflag = ((BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_SENS_LINK) | - (BUTS_CONT_SEL|BUTS_CONT_ACT|BUTS_CONT_LINK) | - (BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_ACT_LINK) | - (BUTS_SENS_STATE|BUTS_ACT_STATE)); - - - /* header */ - ar= MEM_callocN(sizeof(ARegion), "header for logic"); - - BLI_addtail(&slogic->regionbase, ar); - ar->regiontype= RGN_TYPE_HEADER; - ar->alignment= RGN_ALIGN_BOTTOM; - - /* buttons/list view */ - ar= MEM_callocN(sizeof(ARegion), "buttons for logic"); - - BLI_addtail(&slogic->regionbase, ar); - ar->regiontype= RGN_TYPE_UI; - ar->alignment= RGN_ALIGN_RIGHT; - - /* main region */ - ar= MEM_callocN(sizeof(ARegion), "main region for logic"); - - BLI_addtail(&slogic->regionbase, ar); - ar->regiontype= RGN_TYPE_WINDOW; - - ar->v2d.tot.xmin = 0.0f; - ar->v2d.tot.ymax = 0.0f; - ar->v2d.tot.xmax = 1150.0f; - ar->v2d.tot.ymin = ( 1150.0f/(float)sa->winx ) * (float)-sa->winy; - - ar->v2d.cur = ar->v2d.tot; - - ar->v2d.min[0] = 1.0f; - ar->v2d.min[1] = 1.0f; - - ar->v2d.max[0] = 32000.0f; - ar->v2d.max[1] = 32000.0f; - - ar->v2d.minzoom = 0.5f; - ar->v2d.maxzoom = 1.5f; - - ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); - ar->v2d.keepzoom = V2D_KEEPZOOM | V2D_LIMITZOOM | V2D_KEEPASPECT; - ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS; - ar->v2d.align = V2D_ALIGN_NO_POS_Y | V2D_ALIGN_NO_NEG_X; - ar->v2d.keepofs = V2D_KEEPOFS_Y; - - return (SpaceLink *)slogic; -} - -/* not spacelink itself */ -static void logic_free(SpaceLink *UNUSED(sl)) -{ -// Spacelogic *slogic= (SpaceLogic *) sl; - -// if (slogic->gpd) -// XXX BKE_gpencil_free(slogic->gpd); - -} - - -/* spacetype; init callback */ -static void logic_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) -{ - -} - -static SpaceLink *logic_duplicate(SpaceLink *sl) -{ - SpaceLogic *slogicn= MEM_dupallocN(sl); - - return (SpaceLink *)slogicn; -} - -static void logic_operatortypes(void) -{ - WM_operatortype_append(LOGIC_OT_properties); - WM_operatortype_append(LOGIC_OT_links_cut); -} - -static void logic_keymap(struct wmKeyConfig *keyconf) -{ - wmKeyMap *keymap = WM_keymap_find(keyconf, "Logic Editor", SPACE_LOGIC, 0); - - WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "LOGIC_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0); - - WM_keymap_add_item(keymap, "LOGIC_OT_view_all", HOMEKEY, KM_PRESS, 0, 0); -#ifdef WITH_INPUT_NDOF - WM_keymap_add_item(keymap, "LOGIC_OT_view_all", NDOF_BUTTON_FIT, KM_PRESS, 0, 0); -#endif -} - -static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa)) -{ -// SpaceLogic *slogic= CTX_wm_space_logic(C); -// Object *obedit= CTX_data_edit_object(C); - -} - -static void logic_listener( - bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, - wmNotifier *wmn, const Scene *UNUSED(scene)) -{ - /* context changes */ - switch (wmn->category) { - case NC_LOGIC: - ED_region_tag_redraw(ar); - break; - case NC_SCENE: - switch (wmn->data) { - case ND_FRAME: - ED_region_tag_redraw(ar); - break; - - case ND_OB_ACTIVE: - ED_region_tag_redraw(ar); - break; - } - break; - case NC_OBJECT: - break; - case NC_ID: - if (wmn->action == NA_RENAME) - ED_region_tag_redraw(ar); - break; - } -} - -static int logic_context(const bContext *UNUSED(C), const char *UNUSED(member), bContextDataResult *UNUSED(result)) -{ -// SpaceLogic *slogic= CTX_wm_space_logic(C); - return 0; -} - -/************************** main region ***************************/ - - -/* add handlers, stuff you only do once or on area/region changes */ -static void logic_main_region_init(wmWindowManager *wm, ARegion *ar) -{ - wmKeyMap *keymap; - - UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); - - /* own keymaps */ - keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0); - WM_event_add_keymap_handler(&ar->handlers, keymap); -} - -static void logic_main_region_draw(const bContext *C, ARegion *ar) -{ - /* draw entirely, view changes should be handled here */ -// SpaceLogic *slogic= CTX_wm_space_logic(C); - View2D *v2d= &ar->v2d; - View2DScrollers *scrollers; - - /* clear and setup matrix */ - UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); - - UI_view2d_view_ortho(v2d); - - logic_buttons((bContext *)C, ar); - - /* reset view matrix */ - UI_view2d_view_restore(C); - - /* scrollers */ - scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); - UI_view2d_scrollers_draw(C, v2d, scrollers); - UI_view2d_scrollers_free(scrollers); - -} - - -/* *********************** buttons region ************************ */ - -/* add handlers, stuff you only do once or on area/region changes */ -static void logic_buttons_region_init(wmWindowManager *wm, ARegion *ar) -{ - wmKeyMap *keymap; - - ED_region_panels_init(wm, ar); - - keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0); - WM_event_add_keymap_handler(&ar->handlers, keymap); -} - -static void logic_buttons_region_draw(const bContext *C, ARegion *ar) -{ - ED_region_panels(C, ar, NULL, -1, true); -} - -/************************* header region **************************/ - -/* add handlers, stuff you only do once or on area/region changes */ -static void logic_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar) -{ - ED_region_header_init(ar); -} - -static void logic_header_region_draw(const bContext *C, ARegion *ar) -{ - ED_region_header(C, ar); -} - -/**************************** spacetype *****************************/ - -static void logic_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID *new_id) -{ - SpaceLogic *slog = (SpaceLogic *)slink; - - if (!ELEM(GS(old_id->name), ID_GD)) { - return; - } - - if ((ID *)slog->gpd == old_id) { - slog->gpd = (bGPdata *)new_id; - id_us_min(old_id); - id_us_plus(new_id); - } -} - -/* only called once, from space/spacetypes.c */ -void ED_spacetype_logic(void) -{ - SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype logic"); - ARegionType *art; - - st->spaceid = SPACE_LOGIC; - strncpy(st->name, "Logic", BKE_ST_MAXNAME); - - st->new = logic_new; - st->free = logic_free; - st->init = logic_init; - st->duplicate = logic_duplicate; - st->operatortypes = logic_operatortypes; - st->keymap = logic_keymap; - st->refresh = logic_refresh; - st->context = logic_context; - st->id_remap = logic_id_remap; - - /* regions: main window */ - art = MEM_callocN(sizeof(ARegionType), "spacetype logic region"); - art->regionid = RGN_TYPE_WINDOW; - art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES | ED_KEYMAP_VIEW2D; - art->init = logic_main_region_init; - art->draw = logic_main_region_draw; - art->listener = logic_listener; - - BLI_addhead(&st->regiontypes, art); - - /* regions: listview/buttons */ - art = MEM_callocN(sizeof(ARegionType), "spacetype logic region"); - art->regionid = RGN_TYPE_UI; - art->prefsizex= 220; // XXX - art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; - art->listener = logic_listener; - art->init = logic_buttons_region_init; - art->draw = logic_buttons_region_draw; - BLI_addhead(&st->regiontypes, art); - - /* regions: header */ - art= MEM_callocN(sizeof(ARegionType), "spacetype logic region"); - art->regionid = RGN_TYPE_HEADER; - art->prefsizey = HEADERY; - art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; - art->init = logic_header_region_init; - art->draw = logic_header_region_draw; - - BLI_addhead(&st->regiontypes, art); - - BKE_spacetype_register(st); -} - - diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index d148ef3c6fe..d027729c7a7 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -84,13 +84,6 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -if(WITH_GAMEENGINE) - list(APPEND INC - ../../../gameengine/BlenderRoutines - ) - add_definitions(-DWITH_GAMEENGINE) -endif() - add_definitions(${GL_DEFINITIONS}) if(WITH_INTERNATIONAL) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 0d4ec4d42d1..2b3678c4812 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -41,7 +41,6 @@ #include "DNA_meshdata_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" -#include "DNA_property_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_view3d_types.h" @@ -51,7 +50,6 @@ #include "BKE_image.h" #include "BKE_material.h" #include "BKE_paint.h" -#include "BKE_property.h" #include "BKE_editmesh.h" #include "BKE_scene.h" diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 287613c847b..1d54a1937eb 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -328,7 +328,7 @@ bool draw_glsl_material(Scene *scene, ViewLayer *view_layer, Object *ob, View3D return true; if (v3d->drawtype == OB_TEXTURE) - return (scene->gm.matmode == GAME_MAT_GLSL && !BKE_scene_use_new_shading_nodes(scene)); + return !BKE_scene_use_new_shading_nodes(scene); else if (v3d->drawtype == OB_MATERIAL && dt > OB_SOLID) return true; else @@ -1189,51 +1189,6 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z, unsigned pos) glDisable(GL_CULL_FACE); } -#ifdef WITH_GAMEENGINE -static void draw_transp_sun_volume(Lamp *la, unsigned pos) -{ - float box[8][3]; - - /* construct box */ - box[0][0] = box[1][0] = box[2][0] = box[3][0] = -la->shadow_frustum_size; - box[4][0] = box[5][0] = box[6][0] = box[7][0] = +la->shadow_frustum_size; - box[0][1] = box[1][1] = box[4][1] = box[5][1] = -la->shadow_frustum_size; - box[2][1] = box[3][1] = box[6][1] = box[7][1] = +la->shadow_frustum_size; - box[0][2] = box[3][2] = box[4][2] = box[7][2] = -la->clipend; - box[1][2] = box[2][2] = box[5][2] = box[6][2] = -la->clipsta; - - /* draw edges */ - imm_draw_box(box, false, pos); - - /* draw faces */ - glEnable(GL_CULL_FACE); - glEnable(GL_BLEND); - glDepthMask(GL_FALSE); - - /* draw backside darkening */ - glCullFace(GL_FRONT); - - glBlendFunc(GL_ZERO, GL_SRC_ALPHA); - immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); - - imm_draw_box(box, true, pos); - - /* draw front side lighting */ - glCullFace(GL_BACK); - - glBlendFunc(GL_ONE, GL_ONE); - immUniformColor3f(0.2f, 0.2f, 0.2f); - - imm_draw_box(box, true, pos); - - /* restore state */ - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_BLEND); - glDepthMask(GL_TRUE); - glDisable(GL_CULL_FACE); -} -#endif - void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const short dflag, const unsigned char ob_wire_col[4], const bool is_obact) { @@ -1253,22 +1208,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, !(base->flag_legacy & OB_FROMDUPLI) && !is_view); -#ifdef WITH_GAMEENGINE - const bool drawshadowbox = ( - (rv3d->rflag & RV3D_IS_GAME_ENGINE) && - (dt > OB_WIRE) && - !(G.f & G_PICKSEL) && - (la->type == LA_SUN) && - ((la->mode & LA_SHAD_BUF) || - (la->mode & LA_SHAD_RAY)) && - (la->mode & LA_SHOW_SHADOW_BOX) && - !(base->flag_legacy & OB_FROMDUPLI) && - !is_view); -#else - const bool drawshadowbox = false; -#endif - - if ((drawcone || drawshadowbox) && !v3d->transp) { + if (drawcone && !v3d->transp) { /* in this case we need to draw delayed */ ED_view3d_after_add(&v3d->afterdraw_transp, base, dflag); return; @@ -1576,11 +1516,6 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, } } -#ifdef WITH_GAMEENGINE - if (drawshadowbox) { - draw_transp_sun_volume(la, pos); - } -#endif } else if (la->type == LA_AREA) { setlinestyle(3); @@ -4300,11 +4235,7 @@ static void draw_mesh_fancy( Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt, const unsigned char ob_wire_col[4], const short dflag) { -#ifdef WITH_GAMEENGINE - Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, view_layer) : base->object; -#else Object *ob = base->object; -#endif Mesh *me = ob->data; eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; bool /* no_verts,*/ no_edges, no_faces; @@ -4718,11 +4649,7 @@ static void draw_mesh_fancy_new( return; } -#ifdef WITH_GAMEENGINE - Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, view_layer) : base->object; -#else Object *ob = base->object; -#endif Mesh *me = ob->data; eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; /* could be bool draw_wire_overlay */ bool no_edges, no_faces; @@ -8177,33 +8104,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col if (bb == NULL) return; - if (ob->gameflag & OB_BOUNDS) { /* bounds need to be drawn around origin for game engine */ - - if (type == OB_BOUND_BOX) { - float vec[8][3], size[3]; - - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - if (ob_wire_col) immUniformColor3ubv(ob_wire_col); - - BKE_boundbox_calc_size_aabb(bb, size); - - vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = -size[0]; - vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = +size[0]; - vec[0][1] = vec[1][1] = vec[4][1] = vec[5][1] = -size[1]; - vec[2][1] = vec[3][1] = vec[6][1] = vec[7][1] = +size[1]; - vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = -size[2]; - vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = +size[2]; - - imm_draw_box(vec, false, pos); - - immUnbindProgram(); - } - else { - imm_draw_bb(bb, type, true, ob_wire_col); - } - } - else { + { if (type == OB_BOUND_BOX) { unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -8384,48 +8285,6 @@ static void draw_hooks(Object *ob, unsigned int pos) } } -static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data, - const short dflag, const unsigned char ob_wire_col[4]) -{ - const char *axis_str[3] = {"px", "py", "pz"}; - float mat[4][4]; - - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - - if (ob_wire_col) immUniformColor3ubv(ob_wire_col); - - eul_to_mat4(mat, &data->axX); - glLineWidth(4.0f); - setlinestyle(2); - - immBegin(GWN_PRIM_LINES, 6); - for (int axis = 0; axis < 3; axis++) { - float dir[3] = {0, 0, 0}; - float v[3]; - - copy_v3_v3(v, &data->pivX); - - dir[axis] = 1.0f; - mul_m4_v3(mat, dir); - add_v3_v3(v, dir); - immVertex3fv(pos, &data->pivX); - immVertex3fv(pos, v); - - /* when const color is set wirecolor is NULL - we could get the current color but - * with selection and group instancing its not needed to draw the text */ - if ((dflag & DRAW_CONSTCOLOR) == 0) { - view3d_cached_text_draw_add(v, axis_str[axis], 2, 0, V3D_CACHE_TEXT_ASCII, ob_wire_col); - } - } - immEnd(); - - setlinestyle(0); - glLineWidth(1.0f); - - immUnbindProgram(); -} - void draw_object_wire_color(ViewLayer *view_layer, Base *base, unsigned char r_ob_wire_col[4]) { Object *ob = base->object; @@ -9059,23 +8918,6 @@ afterdraw: } if (!render_override) { - bConstraint *con; - - for (con = ob->constraints.first; con; con = con->next) { - if (con->type == CONSTRAINT_TYPE_RIGIDBODYJOINT) { - bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)con->data; - if (data->flag & CONSTRAINT_DRAW_PIVOT) - draw_rigid_body_pivot(data, dflag, ob_wire_col); - } - } - - if ((ob->gameflag & OB_BOUNDS) && (ob->mode == OB_MODE_OBJECT)) { - if (ob->boundtype != ob->collision_boundtype || (dtx & OB_DRAWBOUNDOX) == 0) { - setlinestyle(2); - draw_bounding_volume(ob, ob->collision_boundtype, ob_wire_col); - setlinestyle(0); - } - } if (ob->rigidbody_object) { draw_rigidbody_shape(ob, ob_wire_col); } @@ -9120,33 +8962,6 @@ afterdraw: } } - if ((dt <= OB_SOLID) && !render_override) { - if (((ob->gameflag & OB_DYNAMIC) && - ((ob->gameflag & OB_BOUNDS) == 0)) || - - ((ob->gameflag & OB_BOUNDS) && - (ob->collision_boundtype == OB_BOUND_SPHERE))) - { - float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f}; - - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - - invert_m4_m4(imat, rv3d->viewmatob); - - if ((dflag & DRAW_CONSTCOLOR) == 0) { - /* prevent random colors being used */ - immUniformColor3ubv(ob_wire_col); - } - - setlinestyle(2); - imm_drawcircball(vec, ob->inertia, imat, pos); - setlinestyle(0); - - immUnbindProgram(); - } - } - /* return warning, this is cached text draw */ invert_m4_m4(ob->imat, ob->obmat); view3d_cached_text_draw_end(v3d, ar, 1); diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index dcdcf95bf86..807a4f212f6 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -990,12 +990,6 @@ static void draw_dupli_objects_color( /* Make sure lod is updated from dupli's position */ savedlod = dob->ob->currentlod; -#ifdef WITH_GAMEENGINE - if (rv3d->rflag & RV3D_IS_GAME_ENGINE) { - BKE_object_lod_update(dob->ob, rv3d->viewinv[3]); - } -#endif - /* extra service: draw the duplicator in drawtype of parent, minimum taken * to allow e.g. boundbox box objects in groups for LOD */ dt = tbase.object->dt; @@ -1467,9 +1461,7 @@ CustomDataMask ED_view3d_datamask(const Scene *scene, const View3D *v3d) mask |= CD_MASK_ORCO; } else { - if ((scene->gm.matmode == GAME_MAT_GLSL && drawtype == OB_TEXTURE) || - (drawtype == OB_MATERIAL)) - { + if (drawtype == OB_MATERIAL) { mask |= CD_MASK_ORCO; } } @@ -1925,19 +1917,6 @@ static void view3d_main_region_draw_engine_info(View3D *v3d, RegionView3D *rv3d, ED_region_info_draw(ar, rv3d->render_engine->text, fill_color, true); } -#ifdef WITH_GAMEENGINE -static void update_lods(Scene *scene, float camera_pos[3]) -{ - Scene *sce_iter; - Base *base; - - for (SETLOOPER(scene, sce_iter, base)) { - Object *ob = base->object; - BKE_object_lod_update(ob, camera_pos); - } -} -#endif - static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, const char **grid_unit) { @@ -1964,16 +1943,6 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie VP_legacy_view3d_main_region_setup_view(depsgraph, scene, v3d, ar, NULL, NULL); } - rv3d->rflag &= ~RV3D_IS_GAME_ENGINE; -#ifdef WITH_GAMEENGINE - if (STREQ(scene->view_render.engine_id, RE_engine_id_BLENDER_GAME)) { - rv3d->rflag |= RV3D_IS_GAME_ENGINE; - - /* Make sure LoDs are up to date */ - update_lods(scene, rv3d->viewinv[3]); - } -#endif - /* main drawing call */ view3d_draw_objects(C, depsgraph, scene, v3d, ar, grid_unit, true, false); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 4b005185638..64927ff55c7 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -251,8 +251,6 @@ void VIEW3D_OT_smoothview(struct wmOperatorType *ot); void VIEW3D_OT_camera_to_view(struct wmOperatorType *ot); void VIEW3D_OT_camera_to_view_selected(struct wmOperatorType *ot); void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot); -void VIEW3D_OT_game_start(struct wmOperatorType *ot); - bool ED_view3d_boundbox_clip_ex(const RegionView3D *rv3d, const struct BoundBox *bb, float obmat[4][4]); bool ED_view3d_boundbox_clip(RegionView3D *rv3d, const struct BoundBox *bb); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 8e6f5228b09..0274ddd82fc 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -203,7 +203,6 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_camera_to_view); WM_operatortype_append(VIEW3D_OT_camera_to_view_selected); WM_operatortype_append(VIEW3D_OT_object_as_camera); - WM_operatortype_append(VIEW3D_OT_game_start); WM_operatortype_append(VIEW3D_OT_fly); WM_operatortype_append(VIEW3D_OT_walk); WM_operatortype_append(VIEW3D_OT_navigate); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 1d44f3d3fd5..b6ea68c8fe4 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -64,15 +64,6 @@ #include "DEG_depsgraph_query.h" -#ifdef WITH_GAMEENGINE -# include "BLI_listbase.h" -# include "BLI_callbacks.h" - -# include "GPU_draw.h" - -# include "BL_System.h" -#endif - #include "view3d_intern.h" /* own include */ /* -------------------------------------------------------------------- */ @@ -1090,213 +1081,3 @@ int ED_view3d_view_layer_set(int lay, const int *values, int *active) } /** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Game Engine Operator - * - * Start the game engine (handles context switching). - * \{ */ - -#ifdef WITH_GAMEENGINE - -static ListBase queue_back; -static void game_engine_save_state(bContext *C, wmWindow *win) -{ - Object *obact = CTX_data_active_object(C); - - glPushAttrib(GL_ALL_ATTRIB_BITS); - - if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) { - GPU_paint_set_mipmap(1); - } - - queue_back = win->queue; - - BLI_listbase_clear(&win->queue); -} - -static void game_engine_restore_state(bContext *C, wmWindow *win) -{ - Object *obact = CTX_data_active_object(C); - - if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) { - GPU_paint_set_mipmap(0); - } - /* check because closing win can set to NULL */ - if (win) { - win->queue = queue_back; - } - - GPU_state_init(); - - glPopAttrib(); -} - -/* was space_set_commmandline_options in 2.4x */ -static void game_set_commmandline_options(GameData *gm) -{ - SYS_SystemHandle syshandle; - int test; - - if ((syshandle = SYS_GetSystem())) { - /* User defined settings */ - test = (U.gameflags & USER_DISABLE_MIPMAP); - GPU_set_mipmap(!test); - SYS_WriteCommandLineInt(syshandle, "nomipmap", test); - - /* File specific settings: */ - /* Only test the first one. These two are switched - * simultaneously. */ - test = (gm->flag & GAME_SHOW_FRAMERATE); - SYS_WriteCommandLineInt(syshandle, "show_framerate", test); - SYS_WriteCommandLineInt(syshandle, "show_profile", test); - - test = (gm->flag & GAME_SHOW_DEBUG_PROPS); - SYS_WriteCommandLineInt(syshandle, "show_properties", test); - - test = (gm->flag & GAME_SHOW_PHYSICS); - SYS_WriteCommandLineInt(syshandle, "show_physics", test); - - test = (gm->flag & GAME_ENABLE_ALL_FRAMES); - SYS_WriteCommandLineInt(syshandle, "fixedtime", test); - - test = (gm->flag & GAME_ENABLE_ANIMATION_RECORD); - SYS_WriteCommandLineInt(syshandle, "animation_record", test); - - test = (gm->flag & GAME_IGNORE_DEPRECATION_WARNINGS); - SYS_WriteCommandLineInt(syshandle, "ignore_deprecation_warnings", test); - - test = (gm->matmode == GAME_MAT_MULTITEX); - SYS_WriteCommandLineInt(syshandle, "blender_material", test); - test = (gm->matmode == GAME_MAT_GLSL); - SYS_WriteCommandLineInt(syshandle, "blender_glsl_material", test); - } -} - -#endif /* WITH_GAMEENGINE */ - -static int game_engine_poll(bContext *C) -{ - const wmWindow *win = CTX_wm_window(C); - const Scene *scene = WM_window_get_active_scene(win); - - /* we need a context and area to launch BGE - * it's a temporary solution to avoid crash at load time - * if we try to auto run the BGE. Ideally we want the - * context to be set as soon as we load the file. */ - - if (win == NULL) return 0; - if (CTX_wm_screen(C) == NULL) return 0; - - if (CTX_data_mode_enum(C) != CTX_MODE_OBJECT) - return 0; - - if (!BKE_scene_uses_blender_game(scene)) - return 0; - - return 1; -} - -static int game_engine_exec(bContext *C, wmOperator *op) -{ -#ifdef WITH_GAMEENGINE - Scene *startscene = CTX_data_scene(C); - Main *bmain = CTX_data_main(C); - ScrArea /* *sa, */ /* UNUSED */ *prevsa = CTX_wm_area(C); - ARegion *ar, *prevar = CTX_wm_region(C); - wmWindow *prevwin = CTX_wm_window(C); - RegionView3D *rv3d; - rcti cam_frame; - - UNUSED_VARS(op); - - /* bad context switch .. */ - if (!ED_view3d_context_activate(C)) - return OPERATOR_CANCELLED; - - /* redraw to hide any menus/popups, we don't go back to - * the window manager until after this operator exits */ - WM_redraw_windows(C); - - BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_PRE); - - rv3d = CTX_wm_region_view3d(C); - /* sa = CTX_wm_area(C); */ /* UNUSED */ - ar = CTX_wm_region(C); - - view3d_operator_needs_opengl(C); - - game_set_commmandline_options(&startscene->gm); - - if ((rv3d->persp == RV3D_CAMOB) && - (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) && - (startscene->gm.stereoflag != STEREO_DOME)) - { - Depsgraph *depsgraph = CTX_data_depsgraph(C); - /* Letterbox */ - rctf cam_framef; - ED_view3d_calc_camera_border(startscene, depsgraph, ar, CTX_wm_view3d(C), rv3d, &cam_framef, false); - cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin; - cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin; - cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin; - cam_frame.ymax = cam_framef.ymax + ar->winrct.ymin; - BLI_rcti_isect(&ar->winrct, &cam_frame, &cam_frame); - } - else { - cam_frame.xmin = ar->winrct.xmin; - cam_frame.xmax = ar->winrct.xmax; - cam_frame.ymin = ar->winrct.ymin; - cam_frame.ymax = ar->winrct.ymax; - } - - - game_engine_save_state(C, prevwin); - - StartKetsjiShell(C, ar, &cam_frame, 1); - - /* window wasnt closed while the BGE was running */ - if (BLI_findindex(&CTX_wm_manager(C)->windows, prevwin) == -1) { - prevwin = NULL; - CTX_wm_window_set(C, NULL); - } - - ED_area_tag_redraw(CTX_wm_area(C)); - - if (prevwin) { - /* restore context, in case it changed in the meantime, for - * example by working in another window or closing it */ - CTX_wm_region_set(C, prevar); - CTX_wm_window_set(C, prevwin); - CTX_wm_area_set(C, prevsa); - } - - game_engine_restore_state(C, prevwin); - - //XXX restore_all_scene_cfra(scene_cfra_store); - BKE_scene_set_background(CTX_data_main(C), startscene); - //XXX BKE_scene_graph_update_for_newframe(depsgraph, bmain); - - BLI_callback_exec(bmain, &startscene->id, BLI_CB_EVT_GAME_POST); - - return OPERATOR_FINISHED; -#else - UNUSED_VARS(C); - BKE_report(op->reports, RPT_ERROR, "Game engine is disabled in this build"); - return OPERATOR_CANCELLED; -#endif -} - -void VIEW3D_OT_game_start(wmOperatorType *ot) -{ - /* identifiers */ - ot->name = "Start Game Engine"; - ot->description = "Start game engine"; - ot->idname = "VIEW3D_OT_game_start"; - - /* api callbacks */ - ot->exec = game_engine_exec; - - ot->poll = game_engine_poll; -} - -/** \} */ diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index e3fb67261bb..94b27c8f916 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -234,10 +234,6 @@ data_to_c_simple(shaders/gpu_shader_vertex_world.glsl SRC) data_to_c_simple(shaders/gpu_shader_vsm_store_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_vsm_store_vert.glsl SRC) -if(WITH_GAMEENGINE) - add_definitions(-DWITH_GAMEENGINE) -endif() - if(WITH_MOD_SMOKE) add_definitions(-DWITH_SMOKE) endif() diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index 9bbf46b2a1f..4598ac974c8 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -49,15 +49,12 @@ struct DupliObject; #include "DNA_object_enums.h" -/* OpenGL drawing functions related to shading. These are also - * shared with the game engine, where there were previously - * duplicates of some of these functions. */ +/* OpenGL drawing functions related to shading. */ /* Initialize * - sets the default Blender opengl state, if in doubt, check * the contents of this function - * - this is called when starting Blender, for opengl rendering, - * and for switching back from the game engine for example. */ + * - this is called when starting Blender, for opengl rendering. */ void GPU_state_init(void); @@ -103,14 +100,6 @@ int GPU_default_lights(void); int GPU_scene_object_lights( struct ViewLayer *view_layer, float viewmat[4][4], int ortho); -/* Text render - * - based on moving uv coordinates */ - -void GPU_render_text( - int mode, const char *textstr, int textlen, unsigned int *col, - const float *v_quad[4], const float *uv_quad[4], - int glattrib); - /* Mipmap settings * - these will free textures on changes */ diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 8b344716a9c..e0a71f841fd 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -31,8 +31,8 @@ * Utility functions for dealing with OpenGL texture & material context, * mipmap generation and light objects. * - * These are some obscure rendering functions shared between the - * game engine and the blender, in this module to avoid duplication + * These are some obscure rendering functions shared between the game engine (not anymore) + * and the blender, in this module to avoid duplication * and abstract them away from the rest a bit. */ @@ -70,9 +70,6 @@ #include "BKE_node.h" #include "BKE_scene.h" #include "BKE_DerivedMesh.h" -#ifdef WITH_GAMEENGINE -# include "BKE_object.h" -#endif #include "GPU_basic_shader.h" #include "GPU_buffers.h" @@ -98,131 +95,7 @@ extern Material defmaterial; /* from material.c */ -/* Text Rendering */ - -static void gpu_mcol(unsigned int ucol) -{ - /* mcol order is swapped */ - const char *cp = (char *)&ucol; - glColor3ub(cp[3], cp[2], cp[1]); -} - -void GPU_render_text( - int mode, const char *textstr, int textlen, unsigned int *col, - const float *v_quad[4], const float *uv_quad[4], - int glattrib) -{ - /* XXX, 2.8 removes texface */ -#if 0 - Image *ima = mtexpoly->tpage; -#else - Image *ima = NULL; -#endif - if ((mode & GEMAT_TEXT) && (textlen > 0) && ima) { - const float *v1 = v_quad[0]; - const float *v2 = v_quad[1]; - const float *v3 = v_quad[2]; - const float *v4 = v_quad[3]; - const size_t textlen_st = textlen; - float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance; - - /* multiline */ - float line_start = 0.0f, line_height; - - if (v4) - line_height = max_ffff(v1[1], v2[1], v3[1], v4[2]) - min_ffff(v1[1], v2[1], v3[1], v4[2]); - else - line_height = max_fff(v1[1], v2[1], v3[1]) - min_fff(v1[1], v2[1], v3[1]); - line_height *= 1.2f; /* could be an option? */ - /* end multiline */ - - - /* color has been set */ - if (!col) - glColor3f(1.0f, 1.0f, 1.0f); - - gpuPushMatrix(); - - /* get the tab width */ - ImBuf *first_ibuf = BKE_image_get_first_ibuf(ima); - matrixGlyph(first_ibuf, ' ', ¢erx, ¢ery, - &sizex, &sizey, &transx, &transy, &movex, &movey, &advance); - - float advance_tab = advance * 4; /* tab width could also be an option */ - - - for (size_t index = 0; index < textlen_st; ) { - unsigned int character; - float uv[4][2]; - - /* lets calculate offset stuff */ - character = BLI_str_utf8_as_unicode_and_size_safe(textstr + index, &index); - - if (character == '\n') { - gpuTranslate2f(line_start, -line_height); - line_start = 0.0f; - continue; - } - else if (character == '\t') { - gpuTranslate2f(advance_tab, 0.0f); - line_start -= advance_tab; /* so we can go back to the start of the line */ - continue; - - } - else if (character > USHRT_MAX) { - /* not much we can do here bmfonts take ushort */ - character = '?'; - } - - /* space starts at offset 1 */ - /* character = character - ' ' + 1; */ - matrixGlyph(first_ibuf, character, & centerx, ¢ery, - &sizex, &sizey, &transx, &transy, &movex, &movey, &advance); - - uv[0][0] = (uv_quad[0][0] - centerx) * sizex + transx; - uv[0][1] = (uv_quad[0][1] - centery) * sizey + transy; - uv[1][0] = (uv_quad[1][0] - centerx) * sizex + transx; - uv[1][1] = (uv_quad[1][1] - centery) * sizey + transy; - uv[2][0] = (uv_quad[2][0] - centerx) * sizex + transx; - uv[2][1] = (uv_quad[2][1] - centery) * sizey + transy; - - glBegin(GL_POLYGON); - if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[0]); - else glTexCoord2fv(uv[0]); - if (col) gpu_mcol(col[0]); - glVertex3f(sizex * v1[0] + movex, sizey * v1[1] + movey, v1[2]); - - if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[1]); - else glTexCoord2fv(uv[1]); - if (col) gpu_mcol(col[1]); - glVertex3f(sizex * v2[0] + movex, sizey * v2[1] + movey, v2[2]); - - if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[2]); - else glTexCoord2fv(uv[2]); - if (col) gpu_mcol(col[2]); - glVertex3f(sizex * v3[0] + movex, sizey * v3[1] + movey, v3[2]); - - if (v4) { - uv[3][0] = (uv_quad[3][0] - centerx) * sizex + transx; - uv[3][1] = (uv_quad[3][1] - centery) * sizey + transy; - - if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[3]); - else glTexCoord2fv(uv[3]); - if (col) gpu_mcol(col[3]); - glVertex3f(sizex * v4[0] + movex, sizey * v4[1] + movey, v4[2]); - } - glEnd(); - - gpuTranslate2f(advance, 0.0f); - line_start -= advance; /* so we can go back to the start of the line */ - } - gpuPopMatrix(); - - BKE_image_release_ibuf(ima, first_ibuf, NULL); - } -} - -/* Checking powers of two for images since OpenGL ES requires it */ +//* Checking powers of two for images since OpenGL ES requires it */ #ifdef WITH_DDS static bool is_power_of_2_resolution(int w, int h) { @@ -1553,7 +1426,7 @@ void GPU_end_dupli_object(void) } void GPU_begin_object_materials( - View3D *v3d, RegionView3D *rv3d, Scene *scene, ViewLayer *view_layer, Object *ob, + View3D *v3d, RegionView3D *rv3d, Scene *scene, ViewLayer *UNUSED(view_layer), Object *ob, bool glsl, bool *do_alpha_after) { Material *ma; @@ -1590,14 +1463,6 @@ void GPU_begin_object_materials( } #endif -#ifdef WITH_GAMEENGINE - if (rv3d->rflag & RV3D_IS_GAME_ENGINE) { - ob = BKE_object_lod_matob_get(ob, view_layer); - } -#else - UNUSED_VARS(view_layer); -#endif - /* initialize state */ /* DupliObject must be restored */ dob = GMS.dob; @@ -1843,18 +1708,10 @@ int GPU_object_material_bind(int nr, void *attribs) GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gob->col, auto_bump_scale, &partile_info, object_info); GMS.gboundmat = mat; - /* for glsl use alpha blend mode, unless it's set to solid and - * we are already drawing in an alpha pass */ - if (mat->game.alpha_blend != GPU_BLEND_SOLID) - alphablend = mat->game.alpha_blend; - if (GMS.is_alpha_pass) glDepthMask(1); if (GMS.backface_culling) { - if (mat->game.flag) - glEnable(GL_CULL_FACE); - else - glDisable(GL_CULL_FACE); + glDisable(GL_CULL_FACE); } if (GMS.use_matcaps) @@ -2120,8 +1977,8 @@ static void gpu_disable_multisample(void) /* Default OpenGL State * - * This is called on startup, for opengl offscreen render and to restore state - * for the game engine. Generally we should always return to this state when + * This is called on startup, for opengl offscreen render. + * Generally we should always return to this state when * temporarily modifying the state for drawing, though that are (undocumented) * exceptions that we should try to get rid of. */ diff --git a/source/blender/gpu/intern/gpu_lamp.c b/source/blender/gpu/intern/gpu_lamp.c index 8968521060d..f8ca11782a5 100644 --- a/source/blender/gpu/intern/gpu_lamp.c +++ b/source/blender/gpu/intern/gpu_lamp.c @@ -345,11 +345,9 @@ void GPU_lamp_free(Object *ob) BLI_freelistN(&ob->gpulamp); } -bool GPU_lamp_has_shadow_buffer(GPULamp *lamp) +bool GPU_lamp_has_shadow_buffer(GPULamp *UNUSED(lamp)) { - return (!(lamp->scene->gm.flag & GAME_GLSL_NO_SHADOWS) && - !(lamp->scene->gm.flag & GAME_GLSL_NO_LIGHTS) && - lamp->tex && lamp->fb); + return false; } void GPU_lamp_update_buffer_mats(GPULamp *lamp) diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 98d8eea6036..53ef9835d1d 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1049,7 +1049,7 @@ static void ramp_diffuse_result(GPUShadeInput *shi, GPUNodeLink **diff) Material *ma = shi->mat; GPUMaterial *mat = shi->gpumat; - if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS)) { + { if (ma->ramp_col) { if (ma->rampin_col == MA_RAMP_IN_RESULT) { GPUNodeLink *fac; @@ -1068,9 +1068,7 @@ static void add_to_diffuse( { GPUNodeLink *fac, *tmp, *addcol; - if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) && - ma->ramp_col && (ma->mode & MA_RAMP_COL)) - { + if (ma->ramp_col && (ma->mode & MA_RAMP_COL)) { /* MA_RAMP_IN_RESULT is exceptional */ if (ma->rampin_col == MA_RAMP_IN_RESULT) { addcol = shi->rgb; @@ -1108,9 +1106,7 @@ static void ramp_spec_result(GPUShadeInput *shi, GPUNodeLink **spec) Material *ma = shi->mat; GPUMaterial *mat = shi->gpumat; - if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) && - ma->ramp_spec && ma->rampin_spec == MA_RAMP_IN_RESULT) - { + if (ma->ramp_spec && ma->rampin_spec == MA_RAMP_IN_RESULT) { GPUNodeLink *fac; GPU_link(mat, "ramp_rgbtobw", *spec, &fac); @@ -1224,7 +1220,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la is = inp; /* Lambert */ - if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS)) { + { if (ma->diff_shader == MA_DIFF_ORENNAYAR) GPU_link(mat, "shade_diffuse_oren_nayer", inp, vn, lv, view, GPU_uniform(&ma->roughness), &is); @@ -1240,10 +1236,9 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la } } - if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS)) - if (ma->shade_flag & MA_CUBIC) - GPU_link(mat, "shade_cubic", is, &is); - + if (ma->shade_flag & MA_CUBIC) + GPU_link(mat, "shade_cubic", is, &is); + i = is; GPU_link(mat, "shade_visifac", i, visifac, shi->refl, &i); @@ -1260,8 +1255,8 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la /* this replaces if (i > 0.0) conditional until that is supported */ /* done in shade_visifac now, GPU_link(mat, "mtex_value_clamp_positive", i, &i); */ - if ((ma->mode & MA_SHADOW) && GPU_lamp_has_shadow_buffer(lamp)) { - if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS)) { + if (ma->mode & MA_SHADOW) { + { mat->dynproperty |= DYN_LAMP_PERSMAT; if (lamp->la->shadowmap_type == LA_SHADMAP_VARIANCE) { @@ -1300,7 +1295,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la } } } - else if ((mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) { + else if (lamp->mode & LA_ONLYSHADOW) { add_user_list(&mat->lamps, lamp); return; } @@ -1318,10 +1313,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la } } - if (mat->scene->gm.flag & GAME_GLSL_NO_SHADERS) { - /* pass */ - } - else if (!(lamp->mode & LA_NO_SPEC) && !(lamp->mode & LA_ONLYSHADOW) && + if (!(lamp->mode & LA_NO_SPEC) && !(lamp->mode & LA_ONLYSHADOW) && (GPU_link_changed(shi->spec) || ma->spec != 0.0f)) { if (lamp->type == LA_HEMI) { @@ -1674,7 +1666,7 @@ static void do_material_tex(GPUShadeInput *shi) texture_rgb_blend(mat, tcol, shi->rgb, tin, colfac, mtex->blendtype, &shi->rgb); } - if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_COLSPEC)) { + if (mtex->mapto & MAP_COLSPEC) { GPUNodeLink *colspecfac; if (mtex->colspecfac == 1.0f) colspecfac = stencil; @@ -1698,7 +1690,7 @@ static void do_material_tex(GPUShadeInput *shi) } } - if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_NORM)) { + if (mtex->mapto & MAP_NORM) { if (tex->type == TEX_IMAGE) { found_deriv_map = tex->imaflag & TEX_DERIVATIVEMAP; @@ -1905,7 +1897,7 @@ static void do_material_tex(GPUShadeInput *shi) GPU_link(mat, "mtex_rgbtoint", trgb, &tin); } - if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_REF) { + if (mtex->mapto & MAP_REF) { GPUNodeLink *difffac; if (mtex->difffac == 1.0f) difffac = stencil; @@ -1916,7 +1908,7 @@ static void do_material_tex(GPUShadeInput *shi) mtex->blendtype, &shi->refl); GPU_link(mat, "mtex_value_clamp_positive", shi->refl, &shi->refl); } - if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_SPEC) { + if (mtex->mapto & MAP_SPEC) { GPUNodeLink *specfac; if (mtex->specfac == 1.0f) specfac = stencil; @@ -1927,7 +1919,7 @@ static void do_material_tex(GPUShadeInput *shi) mtex->blendtype, &shi->spec); GPU_link(mat, "mtex_value_clamp_positive", shi->spec, &shi->spec); } - if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_EMIT) { + if (mtex->mapto & MAP_EMIT) { GPUNodeLink *emitfac; if (mtex->emitfac == 1.0f) emitfac = stencil; @@ -1938,7 +1930,7 @@ static void do_material_tex(GPUShadeInput *shi) mtex->blendtype, &shi->emit); GPU_link(mat, "mtex_value_clamp_positive", shi->emit, &shi->emit); } - if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_HAR) { + if (mtex->mapto & MAP_HAR) { GPUNodeLink *hardfac; if (mtex->hardfac == 1.0f) hardfac = stencil; @@ -1961,7 +1953,7 @@ static void do_material_tex(GPUShadeInput *shi) mtex->blendtype, &shi->alpha); GPU_link(mat, "mtex_value_clamp", shi->alpha, &shi->alpha); } - if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_AMB) { + if (mtex->mapto & MAP_AMB) { GPUNodeLink *ambfac; if (mtex->ambfac == 1.0f) ambfac = stencil; @@ -2056,7 +2048,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) do_material_tex(shi); - if ((mat->scene->gm.flag & GAME_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) { + if (ma->mode & MA_SHLESS) { GPU_link(mat, "set_rgb", shi->rgb, &shr->diff); GPU_link(mat, "set_rgb_zero", &shr->spec); GPU_link(mat, "set_value", shi->alpha, &shr->alpha); @@ -2098,8 +2090,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) } /* environment lighting */ - if (!(mat->scene->gm.flag & GAME_GLSL_NO_ENV_LIGHTING) && - (world->mode & WO_ENV_LIGHT) && + if ((world->mode & WO_ENV_LIGHT) && (mat->scene->r.mode & R_SHADOW) && !BKE_scene_use_new_shading_nodes(mat->scene)) { @@ -2608,7 +2599,7 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma, bool use_open else if (new_shading_nodes && ma->alpha < 1.0f) GPU_material_enable_alpha(mat); - if (!(scene->gm.flag & GAME_GLSL_NO_NODES) && ma->nodetree && ma->use_nodes) { + if (ma->nodetree && ma->use_nodes) { /* create nodes */ if (new_shading_nodes) ntreeGPUMaterialNodes(ma->nodetree, mat, NODE_NEW_SHADING); diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index dc2d081f835..af303556090 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -1072,12 +1072,11 @@ static IK_Scene *convert_tree(struct Depsgraph *depsgraph, Scene *blscene, Objec IK_Scene *ikscene; IK_Channel *ikchan; KDL::Frame initPose; - KDL::Rotation boneRot; Bone *bone; int a, numtarget; unsigned int t; float length; - bool ret = true, ingame; + bool ret = true; double *rot; float start[3]; @@ -1094,26 +1093,13 @@ static IK_Scene *convert_tree(struct Depsgraph *depsgraph, Scene *blscene, Objec ikscene->armature = arm; ikscene->scene = scene; ikparam = (bItasc *)ob->pose->ikparam; - ingame = (ob->pose->flag & POSE_GAME_ENGINE); + if (!ikparam) { // you must have our own copy ikparam = &DefIKParam; } - else if (ingame) { - // tweak the param when in game to have efficient stepping - // using fixed substep is not effecient since frames in the GE are often - // shorter than in animation => move to auto step automatically and set - // the target substep duration via min/max - if (!(ikparam->flag & ITASC_AUTO_STEP)) { - float timestep = blscene->r.frs_sec_base / blscene->r.frs_sec; - if (ikparam->numstep > 0) - timestep /= ikparam->numstep; - // with equal min and max, the algorythm will take this step and the indicative substep most of the time - ikparam->minstep = ikparam->maxstep = timestep; - ikparam->flag |= ITASC_AUTO_STEP; - } - } - if ((ikparam->flag & ITASC_SIMULATION) && !ingame) + + if (ikparam->flag & ITASC_SIMULATION) // no cache in animation mode ikscene->cache = new iTaSC::Cache(); @@ -1140,15 +1126,8 @@ static IK_Scene *convert_tree(struct Depsgraph *depsgraph, Scene *blscene, Objec double weight[3]; // build the array of joints corresponding to the IK chain convert_channels(depsgraph, ikscene, tree, ctime); - if (ingame) { - // in the GE, set the initial joint angle to match the current pose - // this will update the jointArray in ikscene - convert_pose(ikscene); - } - else { - // in Blender, the rest pose is always 0 for joints - BKE_pose_rest(ikscene); - } + // in Blender, the rest pose is always 0 for joints + BKE_pose_rest(ikscene); rot = ikscene->jointArray(0); for (a = 0, ikchan = ikscene->channels; a < tree->totchannel; ++a, ++ikchan) { @@ -1787,12 +1766,6 @@ void itasc_execute_tree(struct Depsgraph *depsgraph, struct Scene *scene, Object for (IK_Scene *ikscene = ikdata->first; ikscene; ikscene = ikscene->next) { if (ikscene->channels[0].pchan == pchan_root) { float timestep = scene->r.frs_sec_base / scene->r.frs_sec; - if (ob->pose->flag & POSE_GAME_ENGINE) { - timestep = ob->pose->ctime; - // limit the timestep to avoid excessive number of iteration - if (timestep > 0.2f) - timestep = 0.2f; - } execute_scene(depsgraph, scene, ikscene, ikparam, ctime, timestep); break; } diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index eaf4dfd84b4..2bda07bdbbe 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -1041,7 +1041,7 @@ static IndexBuildContext *index_fallback_create_context(struct anim *anim, IMB_T /* since timecode indices only work with ffmpeg right now, * don't know a sensible fallback here... * - * so no proxies, no game to play... + * so no proxies... */ if (proxy_sizes_in_use == IMB_PROXY_NONE) { return NULL; diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 95cbdeadf87..e1306253df8 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -434,8 +434,7 @@ typedef enum ePose_Flags { POSE_RECALCPATHS = (1 << 4), /* set by BKE_pose_rebuild to give a chance to the IK solver to rebuild IK tree */ POSE_WAS_REBUILT = (1 << 5), - /* set by game_copy_pose to indicate that this pose is used in the game engine */ - POSE_GAME_ENGINE = (1 << 6), + POSE_FLAG_DEPRECATED = (1 << 6), /* deprecated. */ /* pose constraint flags needs to be updated */ POSE_CONSTRAINTS_NEED_UPDATE_FLAGS = (1 << 7), } ePose_Flags; diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h deleted file mode 100644 index 6bdea21da1e..00000000000 --- a/source/blender/makesdna/DNA_actuator_types.h +++ /dev/null @@ -1,583 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file DNA_actuator_types.h - * \ingroup DNA - * - * #bActuator type is specifically for use by Object logic-bricks in the game-engine. - */ - -#ifndef __DNA_ACTUATOR_TYPES_H__ -#define __DNA_ACTUATOR_TYPES_H__ - -struct Object; -struct Mesh; -struct Scene; -struct Group; -struct Text; - -/* ****************** ACTUATORS ********************* */ - -/* unused now, moved to editobjectactuator in 2.02. Still needed for dna */ -typedef struct bAddObjectActuator { - int time, pad; - struct Object *ob; -} bAddObjectActuator; - -typedef struct bActionActuator { - struct bAction *act; /* Pointer to action */ - short type, flag; /* Playback type */ // not in use - float sta, end; /* Start & End frames */ - char name[64]; /* For property-driven playback, MAX_NAME */ - char frameProp[64]; /* Set this property to the actions current frame, MAX_NAME */ - short blendin; /* Number of frames of blending */ - short priority; /* Execution priority */ - short layer; /* Animation layer */ - short end_reset; /* Ending the actuator (negative pulse) wont reset the action to its starting frame */ - short strideaxis; /* Displacement axis */ - short blend_mode; /* Layer blending mode */ - float stridelength; /* Displacement incurred by cycle */ // not in use - float layer_weight; /* How much of the previous layer to use for blending. (<0 = disable, 0 = add mode) */ -} bActionActuator; - -typedef struct Sound3D { - float min_gain; - float max_gain; - float reference_distance; - float max_distance; - float rolloff_factor; - float cone_inner_angle; - float cone_outer_angle; - float cone_outer_gain; -} Sound3D; - -typedef struct bSoundActuator { - short flag, sndnr; - int pad1, pad2; - short pad3[2]; - float volume, pitch; - struct bSound *sound; - struct Sound3D sound3D; - short type, pad4; - short pad5, pad6[1]; -} bSoundActuator; - -typedef struct bEditObjectActuator { - int time; - short type, flag; - struct Object *ob; - struct Mesh *me; - char name[64]; /* MAX_NAME */ - float linVelocity[3]; /* initial lin. velocity on creation */ - float angVelocity[3]; /* initial ang. velocity on creation */ - float mass; - short localflag; /* flag for the lin & ang. vel: apply locally */ - short dyn_operation; - short upflag, trackflag; /* flag for up axis and track axis */ - int pad; -} bEditObjectActuator; - -typedef struct bSceneActuator { - short type, pad1; - int pad; - struct Scene *scene; - struct Object *camera; -} bSceneActuator; - -typedef struct bPropertyActuator { - int pad, type; - char name[64], value[64]; /* MAX_NAME */ - struct Object *ob; -} bPropertyActuator; - -typedef struct bObjectActuator { - short flag, type, otype; - short damping; - float forceloc[3], forcerot[3]; - float pad[3], pad1[3]; - float dloc[3], drot[3]; /* angle in radians */ - float linearvelocity[3], angularvelocity[3]; - struct Object *reference; -} bObjectActuator; - -/* deprecated, handled by bActionActuator now */ -typedef struct bIpoActuator { - short flag, type; - float sta, end; - char name[64]; /* MAX_NAME */ - char frameProp[64]; /* Set this property to the actions current frame, MAX_NAME */ - - short pad1, pad2, pad3, pad4; - -} bIpoActuator; - -typedef struct bCameraActuator { - struct Object *ob; - float height, min, max; - float damping; - short pad1, axis; - float pad2; -} bCameraActuator; - -typedef struct bConstraintActuator { - short type, mode; - short flag, damp; - short time, rotdamp; - int pad; - float minloc[3], maxloc[3]; - float minrot[3], maxrot[3]; - char matprop[64]; /* MAX_NAME */ -} bConstraintActuator; - -typedef struct bGroupActuator { - short flag, type; - int sta, end; - char name[64]; /* property or groupkey, MAX_NAME */ - - short pad[3], cur, butsta, butend;/* not referenced, can remove? */ - /* struct Group *group; not used, remove */ - -} bGroupActuator; - -/* I added a few extra fields here, to facilitate conversions */ -typedef struct bRandomActuator { - int seed; - int distribution; - int int_arg_1; - int int_arg_2; - float float_arg_1; - float float_arg_2; - char propname[64]; /* MAX_NAME */ -} bRandomActuator; - -typedef struct bMessageActuator { - char toPropName[64]; /* Send to all objects with this propertyname. Empty to broadcast. MAX_NAME. */ - struct Object *toObject;/* (Possible future use) pointer to a single destination object. */ - char subject[64]; /* Message Subject to send. MAX_NAME. */ - short bodyType, pad1; /* bodyType is either 'User defined text' or PropName */ - int pad2; - char body[64]; /* Either User Defined Text or our PropName to send value of, MAX_NAME */ -} bMessageActuator; - -typedef struct bGameActuator { - short flag, type; - int sta, end; - char filename[64]; - char loadaniname[64]; -} bGameActuator; - -typedef struct bVisibilityActuator { - /** bit 0: Is this object visible? - ** bit 1: Apply recursively - ** bit 2: Is this object an occluder? */ - int flag; -} bVisibilityActuator; - -typedef struct bTwoDFilterActuator { - char pad[4]; - /* Tells what type of 2D Filter */ - short type; - /* (flag == 0) means 2D filter is activate and - * (flag != 0) means 2D filter is inactive */ - short flag; - int int_arg; - /* a float argument */ - float float_arg; - struct Text *text; -} bTwoDFilterActuator; - -typedef struct bParentActuator { - char pad[2]; - short flag; - int type; - struct Object *ob; -} bParentActuator; - -typedef struct bStateActuator { - int type; /* 0=Set, 1=Add, 2=Rem, 3=Chg */ - unsigned int mask; /* the bits to change */ -} bStateActuator; - -typedef struct bArmatureActuator { - char posechannel[64]; /* MAX_NAME */ - char constraint[64]; /* MAX_NAME */ - int type; /* 0=run, 1=enable, 2=disable, 3=set target, 4=set weight */ - float weight; - float influence; - float pad; - struct Object *target; - struct Object *subtarget; -} bArmatureActuator; - -typedef struct bSteeringActuator { - char pad[5]; - char flag; - short facingaxis; - int type; /* 0=seek, 1=flee, 2=path following */ - float dist; - float velocity; - float acceleration; - float turnspeed; - int updateTime; - struct Object *target; - struct Object *navmesh; -} bSteeringActuator; - -typedef struct bMouseActuator { - short type; /* 0=Visibility, 1=Look */ - short flag; - - int object_axis[2]; - float threshold[2]; - float sensitivity[2]; - float limit_x[2]; - float limit_y[2]; -} bMouseActuator; - - -typedef struct bActuator { - struct bActuator *next, *prev, *mynew; - short type; - /** - * Tells what type of actuator data \ref data holds. - */ - short flag; - short otype, go; - char name[64]; /* MAX_NAME */ - - /** - * data must point to an object actuator type struct. - */ - void *data; - - /** - * For ipo's and props: to find out which object the actuator - * belongs to */ - struct Object *ob; - -} bActuator; - -/* objectactuator->flag */ -#define ACT_FORCE_LOCAL 1 -#define ACT_TORQUE_LOCAL 2 -#define ACT_SERVO_LIMIT_X 2 -#define ACT_DLOC_LOCAL 4 -#define ACT_SERVO_LIMIT_Y 4 -#define ACT_DROT_LOCAL 8 -#define ACT_SERVO_LIMIT_Z 8 -#define ACT_LIN_VEL_LOCAL 16 -#define ACT_ANG_VEL_LOCAL 32 -//#define ACT_ADD_LIN_VEL_LOCAL 64 -#define ACT_ADD_LIN_VEL 64 -#define ACT_ADD_CHAR_LOC 128 -#define ACT_CHAR_JUMP 256 - -/* objectactuator->type */ -#define ACT_OBJECT_NORMAL 0 -#define ACT_OBJECT_SERVO 1 -#define ACT_OBJECT_CHARACTER 2 - -/* actuator->type */ -#define ACT_OBJECT 0 -#define ACT_IPO 1 -#define ACT_LAMP 2 -#define ACT_CAMERA 3 -#define ACT_MATERIAL 4 -#define ACT_SOUND 5 -#define ACT_PROPERTY 6 - /* these two obsolete since 2.02 */ -#define ACT_ADD_OBJECT 7 -#define ACT_END_OBJECT 8 - -#define ACT_CONSTRAINT 9 -#define ACT_EDIT_OBJECT 10 -#define ACT_SCENE 11 -#define ACT_GROUP 12 -#define ACT_RANDOM 13 -#define ACT_MESSAGE 14 -#define ACT_ACTION 15 /* __ NLA */ -#define ACT_GAME 17 -#define ACT_VISIBILITY 18 -#define ACT_2DFILTER 19 -#define ACT_PARENT 20 -#define ACT_SHAPEACTION 21 -#define ACT_STATE 22 -#define ACT_ARMATURE 23 -#define ACT_STEERING 24 -#define ACT_MOUSE 25 - -/* actuator flag */ -#define ACT_SHOW 1 -#define ACT_DEL 2 -#define ACT_NEW 4 -#define ACT_LINKED 8 -#define ACT_VISIBLE 16 -#define ACT_PIN 32 -#define ACT_DEACTIVATE 64 - -/* link codes */ -#define LINK_SENSOR 0 -#define LINK_CONTROLLER 1 -#define LINK_ACTUATOR 2 - -/* keyboardsensor->type */ -#define SENS_ALL_KEYS 1 - -/* actionactuator->type */ -#define ACT_ACTION_PLAY 0 -#define ACT_ACTION_PINGPONG 1 -#define ACT_ACTION_FLIPPER 2 -#define ACT_ACTION_LOOP_STOP 3 -#define ACT_ACTION_LOOP_END 4 -#define ACT_ACTION_KEY2KEY 5 -#define ACT_ACTION_FROM_PROP 6 -#define ACT_ACTION_MOTION 7 - -/* actionactuator->blend_mode */ -#define ACT_ACTION_BLEND 0 -#define ACT_ACTION_ADD 1 - -/* ipoactuator->type */ -/* used for conversion from 2.01 */ -#define ACT_IPO_FROM_PROP 6 - -/* groupactuator->type */ -#define ACT_GROUP_PLAY 0 -#define ACT_GROUP_PINGPONG 1 -#define ACT_GROUP_FLIPPER 2 -#define ACT_GROUP_LOOP_STOP 3 -#define ACT_GROUP_LOOP_END 4 -#define ACT_GROUP_FROM_PROP 5 -#define ACT_GROUP_SET 6 - -/* ipoactuator->flag */ -#define ACT_IPOFORCE (1 << 0) -#define ACT_IPOEND (1 << 1) -#define ACT_IPOLOCAL (1 << 2) -#define ACT_IPOCHILD (1 << 4) -#define ACT_IPOADD (1 << 5) - -/* property actuator->type */ -#define ACT_PROP_ASSIGN 0 -#define ACT_PROP_ADD 1 -#define ACT_PROP_COPY 2 -#define ACT_PROP_TOGGLE 3 -#define ACT_PROP_LEVEL 4 - -/* constraint flag */ -#define ACT_CONST_NONE 0 -#define ACT_CONST_LOCX 1 -#define ACT_CONST_LOCY 2 -#define ACT_CONST_LOCZ 4 -#define ACT_CONST_ROTX 8 -#define ACT_CONST_ROTY 16 -#define ACT_CONST_ROTZ 32 -#define ACT_CONST_NORMAL 64 -#define ACT_CONST_MATERIAL 128 -#define ACT_CONST_PERMANENT 256 -#define ACT_CONST_DISTANCE 512 -#define ACT_CONST_LOCAL 1024 -#define ACT_CONST_DOROTFH 2048 - -/* constraint mode */ -#define ACT_CONST_DIRPX 1 -#define ACT_CONST_DIRPY 2 -#define ACT_CONST_DIRPZ 4 -#define ACT_CONST_DIRNX 8 -#define ACT_CONST_DIRNY 16 -#define ACT_CONST_DIRNZ 32 - -/* constraint type */ -#define ACT_CONST_TYPE_LOC 0 -#define ACT_CONST_TYPE_DIST 1 -#define ACT_CONST_TYPE_ORI 2 -#define ACT_CONST_TYPE_FH 3 - -/* editObjectActuator->type */ -#define ACT_EDOB_ADD_OBJECT 0 -#define ACT_EDOB_END_OBJECT 1 -#define ACT_EDOB_REPLACE_MESH 2 -#define ACT_EDOB_TRACK_TO 3 -#define ACT_EDOB_DYNAMICS 4 - -/* editObjectActuator->localflag */ -#define ACT_EDOB_LOCAL_LINV 2 -#define ACT_EDOB_LOCAL_ANGV 4 - -/* editObjectActuator->flag */ -#define ACT_TRACK_3D 1 - -/* editObjectActuator->upflag */ -#define ACT_TRACK_UP_X 0 -#define ACT_TRACK_UP_Y 1 -#define ACT_TRACK_UP_Z 2 - -/* editObjectActuator->trackflag */ -#define ACT_TRACK_TRAXIS_X 0 -#define ACT_TRACK_TRAXIS_Y 1 -#define ACT_TRACK_TRAXIS_Z 2 -#define ACT_TRACK_TRAXIS_NEGX 3 -#define ACT_TRACK_TRAXIS_NEGY 4 -#define ACT_TRACK_TRAXIS_NEGZ 5 - -/* editObjectActuator->flag for replace mesh actuator */ -#define ACT_EDOB_REPLACE_MESH_NOGFX 2 /* use for replace mesh actuator */ -#define ACT_EDOB_REPLACE_MESH_PHYS 4 - -/* editObjectActuator->dyn_operation */ -#define ACT_EDOB_RESTORE_DYN 0 -#define ACT_EDOB_SUSPEND_DYN 1 -#define ACT_EDOB_ENABLE_RB 2 -#define ACT_EDOB_DISABLE_RB 3 -#define ACT_EDOB_SET_MASS 4 - - -/* SceneActuator->type */ -#define ACT_SCENE_RESTART 0 -#define ACT_SCENE_SET 1 -#define ACT_SCENE_CAMERA 2 -#define ACT_SCENE_ADD_FRONT 3 -#define ACT_SCENE_ADD_BACK 4 -#define ACT_SCENE_REMOVE 5 -#define ACT_SCENE_SUSPEND 6 -#define ACT_SCENE_RESUME 7 - - -/* randomAct->distribution */ -#define ACT_RANDOM_BOOL_CONST 0 -#define ACT_RANDOM_BOOL_UNIFORM 1 -#define ACT_RANDOM_BOOL_BERNOUILLI 2 -#define ACT_RANDOM_INT_CONST 3 -#define ACT_RANDOM_INT_UNIFORM 4 -#define ACT_RANDOM_INT_POISSON 5 -#define ACT_RANDOM_FLOAT_CONST 6 -#define ACT_RANDOM_FLOAT_UNIFORM 7 -#define ACT_RANDOM_FLOAT_NORMAL 8 -#define ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL 9 - -/* SoundActuator->flag */ -#define ACT_SND_3D_SOUND 1 - -/* SoundActuator->type */ -#define ACT_SND_PLAY_STOP_SOUND 0 -#define ACT_SND_PLAY_END_SOUND 1 -#define ACT_SND_LOOP_STOP_SOUND 2 -#define ACT_SND_LOOP_END_SOUND 3 -#define ACT_SND_LOOP_BIDIRECTIONAL_SOUND 4 -#define ACT_SND_LOOP_BIDIRECTIONAL_STOP_SOUND 5 - -/* messageactuator->type */ -#define ACT_MESG_MESG 0 -#define ACT_MESG_PROP 1 - -/* gameactuator->type */ -#define ACT_GAME_LOAD 0 -#define ACT_GAME_START 1 -#define ACT_GAME_RESTART 2 -#define ACT_GAME_QUIT 3 -#define ACT_GAME_SAVECFG 4 -#define ACT_GAME_LOADCFG 5 -#define ACT_GAME_SCREENSHOT 6 - -/* visibilityact->flag */ -/* Set means the object will become invisible */ -#define ACT_VISIBILITY_INVISIBLE (1 << 0) -#define ACT_VISIBILITY_RECURSIVE (1 << 1) -#define ACT_VISIBILITY_OCCLUSION (1 << 2) - -/* twodfilter->type */ -#define ACT_2DFILTER_ENABLED -2 -#define ACT_2DFILTER_DISABLED -1 -#define ACT_2DFILTER_NOFILTER 0 -#define ACT_2DFILTER_MOTIONBLUR 1 -#define ACT_2DFILTER_BLUR 2 -#define ACT_2DFILTER_SHARPEN 3 -#define ACT_2DFILTER_DILATION 4 -#define ACT_2DFILTER_EROSION 5 -#define ACT_2DFILTER_LAPLACIAN 6 -#define ACT_2DFILTER_SOBEL 7 -#define ACT_2DFILTER_PREWITT 8 -#define ACT_2DFILTER_GRAYSCALE 9 -#define ACT_2DFILTER_SEPIA 10 -#define ACT_2DFILTER_INVERT 11 -#define ACT_2DFILTER_CUSTOMFILTER 12 -#define ACT_2DFILTER_NUMBER_OF_FILTERS 13 - -/* parentactuator->type */ -#define ACT_PARENT_SET 0 -#define ACT_PARENT_REMOVE 1 - -/* parentactuator->flag */ -#define ACT_PARENT_COMPOUND 1 -#define ACT_PARENT_GHOST 2 - -/* armatureactuator->type */ -#define ACT_ARM_RUN 0 -#define ACT_ARM_ENABLE 1 -#define ACT_ARM_DISABLE 2 -#define ACT_ARM_SETTARGET 3 -#define ACT_ARM_SETWEIGHT 4 -#define ACT_ARM_SETINFLUENCE 5 -/* update this define if more types are added */ -#define ACT_ARM_MAXTYPE 5 - -/* stateactuator->type */ -#define ACT_STATE_SET 0 -#define ACT_STATE_ADD 1 -#define ACT_STATE_REMOVE 2 -#define ACT_STATE_CHANGE 3 - -/* steeringactuator->type */ -#define ACT_STEERING_SEEK 0 -#define ACT_STEERING_FLEE 1 -#define ACT_STEERING_PATHFOLLOWING 2 -/* steeringactuator->flag */ -#define ACT_STEERING_SELFTERMINATED 1 -#define ACT_STEERING_ENABLEVISUALIZATION 2 -#define ACT_STEERING_AUTOMATICFACING 4 -#define ACT_STEERING_NORMALUP 8 -#define ACT_STEERING_LOCKZVEL 16 - -/* mouseactuator->type */ -#define ACT_MOUSE_VISIBILITY 0 -#define ACT_MOUSE_LOOK 1 - -/* mouseactuator->flag */ -#define ACT_MOUSE_VISIBLE (1 << 0) -#define ACT_MOUSE_USE_AXIS_X (1 << 1) -#define ACT_MOUSE_USE_AXIS_Y (1 << 2) -#define ACT_MOUSE_RESET_X (1 << 3) -#define ACT_MOUSE_RESET_Y (1 << 4) -#define ACT_MOUSE_LOCAL_X (1 << 5) -#define ACT_MOUSE_LOCAL_Y (1 << 6) - -/* mouseactuator->object_axis */ -#define ACT_MOUSE_OBJECT_AXIS_X 0 -#define ACT_MOUSE_OBJECT_AXIS_Y 1 -#define ACT_MOUSE_OBJECT_AXIS_Z 2 - -#endif /* __DNA_ACTUATOR_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 4c4440ad573..9a87b64ac08 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -488,7 +488,7 @@ typedef enum eBConstraint_Types { CONSTRAINT_TYPE_DISTLIMIT = 14, /* limit distance */ CONSTRAINT_TYPE_STRETCHTO = 15, /* claiming this to be mine :) is in tuhopuu bjornmose */ CONSTRAINT_TYPE_MINMAX = 16, /* floor constraint */ - CONSTRAINT_TYPE_RIGIDBODYJOINT = 17, /* rigidbody constraint */ + /* CONSTRAINT_TYPE_DEPRECATED = 17 */ CONSTRAINT_TYPE_CLAMPTO = 18, /* clampto constraint */ CONSTRAINT_TYPE_TRANSFORM = 19, /* transformation (loc/rot/size -> loc/rot/size) constraint */ CONSTRAINT_TYPE_SHRINKWRAP = 20, /* shrinkwrap (loc/rot) constraint */ @@ -841,10 +841,6 @@ typedef enum eObjectSolver_Flags { OBJECTSOLVER_ACTIVECLIP = (1<<0) } eObjectSolver_Flags; -/* Rigid-Body Constraint */ -#define CONSTRAINT_DRAW_PIVOT 0x40 -#define CONSTRAINT_DISABLE_LINKED_COLLISION 0x80 - /* ObjectSolver Constraint -> flag */ typedef enum eStretchTo_Flags { STRETCHTOCON_USE_BULGE_MIN = (1 << 0), diff --git a/source/blender/makesdna/DNA_controller_types.h b/source/blender/makesdna/DNA_controller_types.h deleted file mode 100644 index 154542d60c5..00000000000 --- a/source/blender/makesdna/DNA_controller_types.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file DNA_controller_types.h - * \ingroup DNA - * - * #bController type is specifically for use by Object logic-bricks in the game-engine. - */ - -#ifndef __DNA_CONTROLLER_TYPES_H__ -#define __DNA_CONTROLLER_TYPES_H__ - -struct bActuator; -struct Text; -struct bSensor; - -/* ****************** CONTROLLERS ********************* */ - -typedef struct bExpressionCont { - char str[128]; -} bExpressionCont; - -typedef struct bPythonCont { - struct Text *text; - char module[64]; - int mode; - int flag; /* only used for debug now */ -} bPythonCont; - -typedef struct bController { - struct bController *next, *prev, *mynew; - short type, flag, inputs, totlinks; - short otype, totslinks, pad2, pad3; - - char name[64]; - void *data; - - struct bActuator **links; - - struct bSensor **slinks; - short val, valo; - unsigned int state_mask; - -} bController; - -/* controller->type */ -#define CONT_LOGIC_AND 0 -#define CONT_LOGIC_OR 1 -#define CONT_EXPRESSION 2 -#define CONT_PYTHON 3 -#define CONT_LOGIC_NAND 4 -#define CONT_LOGIC_NOR 5 -#define CONT_LOGIC_XOR 6 -#define CONT_LOGIC_XNOR 7 - -/* controller->flag */ -#define CONT_SHOW 1 -#define CONT_DEL 2 -#define CONT_NEW 4 -#define CONT_MASK 8 -#define CONT_PRIO 16 -#define CONT_DEACTIVATE 32 - -/* pyctrl->flag */ -#define CONT_PY_DEBUG 1 - -/* pyctrl->mode */ -#define CONT_PY_SCRIPT 0 -#define CONT_PY_MODULE 1 - -#endif /* __DNA_CONTROLLER_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index bc33b7ba6e2..b6f74c7e6f7 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -75,14 +75,6 @@ typedef struct VolumeSettings { float ms_spread; } VolumeSettings; -/* Game Engine Options (old Texface mode, transp and flag) */ -typedef struct GameSettings { - int flag; - int alpha_blend; - int face_orientation; - int pad1; -} GameSettings; - typedef struct TexPaintSlot { struct Image *ima; /* image to be painted on */ char *uvname; /* customdata index for uv layer, MAX_NAME*/ @@ -116,7 +108,6 @@ typedef struct Material { /* end synced with render_types.h */ struct VolumeSettings vol; - struct GameSettings game; float fresnel_mir, fresnel_mir_i; float fresnel_tra, fresnel_tra_i; @@ -228,33 +219,6 @@ typedef struct Material { ListBase gpumaterial; /* runtime */ } Material; - -/* **************** GAME PROPERTIES ********************* */ -// Blend Transparency Options - alpha_blend /* match GPU_material::GPUBlendMode */ -#define GEMAT_SOLID 0 /* GPU_BLEND_SOLID */ -#define GEMAT_ADD 1 /* GPU_BLEND_ADD */ -#define GEMAT_ALPHA 2 /* GPU_BLEND_ALPHA */ -#define GEMAT_CLIP 4 /* GPU_BLEND_CLIP */ -#define GEMAT_ALPHA_SORT 8 /* GPU_BLEND_ALPHA_SORT */ -#define GEMAT_ALPHA_TO_COVERAGE 16 /* GPU_BLEND_ALPHA_TO_COVERAGE */ - -// Game Options - flag -#define GEMAT_BACKCULL 16 /* KX_BACKCULL */ -#define GEMAT_SHADED 32 /* KX_LIGHT */ -#define GEMAT_TEXT 64 /* RAS_RENDER_3DPOLYGON_TEXT */ -#define GEMAT_NOPHYSICS 128 -#define GEMAT_INVISIBLE 256 - -// Face Orientation Options - face_orientation -#define GEMAT_NORMAL 0 -#define GEMAT_HALO 512 /* BILLBOARD_SCREENALIGNED */ -#define GEMAT_BILLBOARD 1024 /* BILLBOARD_AXISALIGNED */ -#define GEMAT_SHADOW 2048 /* SHADOW */ - -// Use Textures - not defined directly in the UI -#define GEMAT_TEX 4096 /* KX_TEX */ - - /* **************** MATERIAL ********************* */ /* maximum number of materials per material array. diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h index e7ebd3b72d7..16c96073469 100644 --- a/source/blender/makesdna/DNA_object_force_types.h +++ b/source/blender/makesdna/DNA_object_force_types.h @@ -218,59 +218,6 @@ typedef struct SBVertex { float vec[4]; } SBVertex; -typedef struct BulletSoftBody { - int flag; /* various boolean options */ - float linStiff; /* linear stiffness 0..1 */ - float angStiff; /* angular stiffness 0..1 */ - float volume; /* volume preservation 0..1 */ - - int viterations; /* Velocities solver iterations */ - int piterations; /* Positions solver iterations */ - int diterations; /* Drift solver iterations */ - int citerations; /* Cluster solver iterations */ - - float kSRHR_CL; /* Soft vs rigid hardness [0,1] (cluster only) */ - float kSKHR_CL; /* Soft vs kinetic hardness [0,1] (cluster only) */ - float kSSHR_CL; /* Soft vs soft hardness [0,1] (cluster only) */ - float kSR_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - - float kSK_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - float kSS_SPLT_CL; /* Soft vs rigid impulse split [0,1] (cluster only) */ - float kVCF; /* Velocities correction factor (Baumgarte) */ - float kDP; /* Damping coefficient [0,1] */ - - float kDG; /* Drag coefficient [0,+inf] */ - float kLF; /* Lift coefficient [0,+inf] */ - float kPR; /* Pressure coefficient [-inf,+inf] */ - float kVC; /* Volume conversation coefficient [0,+inf] */ - - float kDF; /* Dynamic friction coefficient [0,1] */ - float kMT; /* Pose matching coefficient [0,1] */ - float kCHR; /* Rigid contacts hardness [0,1] */ - float kKHR; /* Kinetic contacts hardness [0,1] */ - - float kSHR; /* Soft contacts hardness [0,1] */ - float kAHR; /* Anchors hardness [0,1] */ - int collisionflags; /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */ - int numclusteriterations; /* number of iterations to refine collision clusters*/ - float welding; /* welding limit to remove duplicate/nearby vertices, 0.0..0.01 */ - float margin; /* margin specific to softbody */ -} BulletSoftBody; - -/* BulletSoftBody.flag */ -#define OB_BSB_SHAPE_MATCHING 2 -// #define OB_BSB_UNUSED 4 -#define OB_BSB_BENDING_CONSTRAINTS 8 -#define OB_BSB_AERO_VPOINT 16 /* aero model, Vertex normals are oriented toward velocity*/ -// #define OB_BSB_AERO_VTWOSIDE 32 /* aero model, Vertex normals are flipped to match velocity */ - -/* BulletSoftBody.collisionflags */ -#define OB_BSB_COL_SDF_RS 2 /* SDF based rigid vs soft */ -#define OB_BSB_COL_CL_RS 4 /* Cluster based rigid vs soft */ -#define OB_BSB_COL_CL_SS 8 /* Cluster based soft vs soft */ -#define OB_BSB_COL_VF_SS 16 /* Vertex/Face based soft vs soft */ - - typedef struct SoftBody { /* dynamic data */ int totpoint, totspring; diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 2cbc266ea0c..bb17b10b299 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -212,9 +212,7 @@ typedef struct Object { short transflag, protectflag; /* transformation settings and transform locks */ short trackflag, upflag; short nlaflag; /* used for DopeSheet filtering settings (expanded/collapsed) */ - short scaflag; /* ui state for game logic */ - char scavisflag; /* more display settings for game logic */ - char pad; + short pad[2]; /* did last modifier stack generation need mapping support? */ char lastNeedMapping; /* bool */ @@ -223,39 +221,9 @@ typedef struct Object { /* dupli-frame settings */ int dupon, dupoff, dupsta, dupend; - /* during realtime */ - - /* note that inertia is only called inertia for historical reasons - * and is not changed to avoid DNA surgery. It actually reflects the - * Size value in the GameButtons (= radius) */ - - float mass, damping, inertia; - /* The form factor k is introduced to give the user more control - * and to fix incompatibility problems. - * For rotational symmetric objects, the inertia value can be - * expressed as: Theta = k * m * r^2 - * where m = Mass, r = Radius - * For a Sphere, the form factor is by default = 0.4 - */ - - float formfactor; - float rdamping; - float margin; - float max_vel; /* clamp the maximum velocity 0.0 is disabled */ - float min_vel; /* clamp the minimum velocity 0.0 is disabled */ - float max_angvel; /* clamp the maximum angular velocity, 0.0 is disabled */ - float min_angvel; /* clamp the minimum angular velocity, 0.0 is disabled */ - float obstacleRad; - - /* "Character" physics properties */ - float step_height; - float jump_speed; - float fall_speed; - unsigned char max_jumps; - char pad2; - /* Depsgraph */ short base_flag; /* used by depsgraph, flushed from base */ + short pad8; /** Collision mask settings */ unsigned short col_group, col_mask; @@ -270,11 +238,6 @@ typedef struct Object { char empty_drawtype; float empty_drawsize; float dupfacesca; /* dupliface scale */ - - ListBase prop; /* game logic property list (not to be confused with IDProperties) */ - ListBase sensors; /* game logic sensors */ - ListBase controllers; /* game logic controllers */ - ListBase actuators; /* game logic actuators */ float sf; /* sf is time-offset */ @@ -284,25 +247,22 @@ typedef struct Object { unsigned char pad5[6]; float col[4]; /* object color */ - int gameflag; - int gameflag2; - char restrictflag; /* for restricting view, select, render etc. accessible in outliner */ char pad3; short softflag; /* softbody settings */ - float anisotropicFriction[3]; + float pad9[3]; ListBase constraints; /* object constraints */ ListBase nlastrips DNA_DEPRECATED; // XXX deprecated... old animation system ListBase hooks DNA_DEPRECATED; // XXX deprecated... old animation system ListBase particlesystem; /* particle systems */ - struct BulletSoftBody *bsoft; /* settings for game engine bullet soft body */ struct PartDeflect *pd; /* particle deflector/attractor/collision data */ struct SoftBody *soft; /* if exists, saved in file */ struct Group *dup_group; /* object duplicator for group */ + void *pad10; - char body_type; /* for now used to temporarily holds the type of collision object */ + char pad4; char shapeflag; /* flag for pinning */ short shapenr; /* current shape key for menu or pinned */ float smoothresh; /* smoothresh is phong interpolation ray_shadow correction in render */ @@ -313,8 +273,6 @@ typedef struct Object { void *pad7; uint64_t lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */ uint64_t customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */ - unsigned int state; /* bit masks of game controllers that are active */ - unsigned int init_state; /* bit masks of initial state as recorded by the users */ /* Runtime valuated curve-specific data, not stored in the file */ struct CurveCache *curve_cache; @@ -476,8 +434,6 @@ enum { OB_NEGZ = 5, }; -/* gameflag in game.h */ - /* dt: no flags */ enum { OB_BOUNDBOX = 1, @@ -580,84 +536,6 @@ enum { /* collision masks */ #define OB_MAX_COL_MASKS 16 -/* ob->gameflag */ -enum { - OB_DYNAMIC = 1 << 0, - OB_CHILD = 1 << 1, - OB_ACTOR = 1 << 2, - OB_INERTIA_LOCK_X = 1 << 3, - OB_INERTIA_LOCK_Y = 1 << 4, - OB_INERTIA_LOCK_Z = 1 << 5, - OB_DO_FH = 1 << 6, - OB_ROT_FH = 1 << 7, - OB_ANISOTROPIC_FRICTION = 1 << 8, - OB_GHOST = 1 << 9, - OB_RIGID_BODY = 1 << 10, - OB_BOUNDS = 1 << 11, - - OB_COLLISION_RESPONSE = 1 << 12, - OB_SECTOR = 1 << 13, - OB_PROP = 1 << 14, - OB_MAINACTOR = 1 << 15, - - OB_COLLISION = 1 << 16, - OB_SOFT_BODY = 1 << 17, - OB_OCCLUDER = 1 << 18, - OB_SENSOR = 1 << 19, - OB_NAVMESH = 1 << 20, - OB_HASOBSTACLE = 1 << 21, - OB_CHARACTER = 1 << 22, - - OB_RECORD_ANIMATION = 1 << 23, -}; - -/* ob->gameflag2 */ -enum { - OB_NEVER_DO_ACTIVITY_CULLING = 1 << 0, - OB_LOCK_RIGID_BODY_X_AXIS = 1 << 2, - OB_LOCK_RIGID_BODY_Y_AXIS = 1 << 3, - OB_LOCK_RIGID_BODY_Z_AXIS = 1 << 4, - OB_LOCK_RIGID_BODY_X_ROT_AXIS = 1 << 5, - OB_LOCK_RIGID_BODY_Y_ROT_AXIS = 1 << 6, - OB_LOCK_RIGID_BODY_Z_ROT_AXIS = 1 << 7, - -/* OB_LIFE = OB_PROP | OB_DYNAMIC | OB_ACTOR | OB_MAINACTOR | OB_CHILD, */ -}; - -/* ob->body_type */ -enum { - OB_BODY_TYPE_NO_COLLISION = 0, - OB_BODY_TYPE_STATIC = 1, - OB_BODY_TYPE_DYNAMIC = 2, - OB_BODY_TYPE_RIGID = 3, - OB_BODY_TYPE_SOFT = 4, - OB_BODY_TYPE_OCCLUDER = 5, - OB_BODY_TYPE_SENSOR = 6, - OB_BODY_TYPE_NAVMESH = 7, - OB_BODY_TYPE_CHARACTER = 8, -}; - -/* ob->scavisflag */ -enum { - OB_VIS_SENS = 1 << 0, - OB_VIS_CONT = 1 << 1, - OB_VIS_ACT = 1 << 2, -}; - -/* ob->scaflag */ -enum { - OB_SHOWSENS = 1 << 6, - OB_SHOWACT = 1 << 7, - OB_ADDSENS = 1 << 8, - OB_ADDCONT = 1 << 9, - OB_ADDACT = 1 << 10, - OB_SHOWCONT = 1 << 11, - OB_ALLSTATE = 1 << 12, - OB_INITSTBIT = 1 << 13, - OB_DEBUGSTATE = 1 << 14, - OB_SHOWSTATE = 1 << 15, -}; - /* ob->restrictflag */ enum { OB_RESTRICT_VIEW = 1 << 0, diff --git a/source/blender/makesdna/DNA_property_types.h b/source/blender/makesdna/DNA_property_types.h deleted file mode 100644 index 77cd7c3e102..00000000000 --- a/source/blender/makesdna/DNA_property_types.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file DNA_property_types.h - * \ingroup DNA - * \since mar-2001 - * \author nzc - * \attention Renderrecipe and scene decription. The fact that there is a - * hierarchy here is a bit strange, and not desirable. - * - * #bProperty type is specifically for use by Objects game-logic. - */ - -#ifndef __DNA_PROPERTY_TYPES_H__ -#define __DNA_PROPERTY_TYPES_H__ - -/* ********************* PROPERTY ************************ */ - -typedef struct bProperty { - struct bProperty *next, *prev; - char name[64]; /* MAX_NAME */ - short type, flag; - int data; /* data should be 4 bytes to store int,float stuff */ - void *poin; /* references data unless its a string which is malloc'd */ - -} bProperty; - -/* property->type XXX Game Property, not RNA */ -#define GPROP_BOOL 0 -#define GPROP_INT 1 -#define GPROP_FLOAT 2 -#define GPROP_STRING 3 -// #define GPROP_VECTOR 4 // UNUSED -#define GPROP_TIME 5 - -/* property->flag */ -#define PROP_DEBUG 1 - -#define MAX_PROPSTRING 128 - -#endif /* __DNA_PROPERTY_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 3b7875ea5b1..db997aed1cb 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -745,13 +745,6 @@ typedef struct RenderData { short jp2_preset DNA_DEPRECATED, jp2_depth DNA_DEPRECATED; /*deprecated*/ int rpad3; - /* Dome variables */ // XXX deprecated since 2.5 - short domeres DNA_DEPRECATED, domemode DNA_DEPRECATED; // XXX deprecated since 2.5 - short domeangle DNA_DEPRECATED, dometilt DNA_DEPRECATED; // XXX deprecated since 2.5 - float domeresbuf DNA_DEPRECATED; // XXX deprecated since 2.5 - float pad2; - struct Text *dometext DNA_DEPRECATED; // XXX deprecated since 2.5 - /* Freestyle line thickness options */ int line_thickness_mode; float unit_line_thickness; /* in pixels */ @@ -803,180 +796,6 @@ typedef struct RenderProfile { } RenderProfile; -/* *************************************************************** */ -/* Game Engine - Dome */ - -typedef struct GameDome { - short res, mode; - short angle, tilt; - float resbuf, pad2; - struct Text *warptext; -} GameDome; - -/* GameDome.mode */ -#define DOME_FISHEYE 1 -#define DOME_TRUNCATED_FRONT 2 -#define DOME_TRUNCATED_REAR 3 -#define DOME_ENVMAP 4 -#define DOME_PANORAM_SPH 5 -#define DOME_NUM_MODES 6 - -/* *************************************************************** */ -/* Game Engine */ - -typedef struct GameFraming { - float col[3]; - char type, pad1, pad2, pad3; -} GameFraming; - -/* GameFraming.type */ -#define SCE_GAMEFRAMING_BARS 0 -#define SCE_GAMEFRAMING_EXTEND 1 -#define SCE_GAMEFRAMING_SCALE 2 - -typedef struct RecastData { - float cellsize; - float cellheight; - float agentmaxslope; - float agentmaxclimb; - float agentheight; - float agentradius; - float edgemaxlen; - float edgemaxerror; - float regionminsize; - float regionmergesize; - int vertsperpoly; - float detailsampledist; - float detailsamplemaxerror; - char partitioning; - char pad1; - short pad2; -} RecastData; - -/* RecastData.partitioning */ -#define RC_PARTITION_WATERSHED 0 -#define RC_PARTITION_MONOTONE 1 -#define RC_PARTITION_LAYERS 2 - -typedef struct GameData { - - /* standalone player */ - struct GameFraming framing; - short playerflag, xplay, yplay, freqplay; - short depth, attrib, rt1, rt2; - short aasamples, pad4[3]; - - /* stereo/dome mode */ - struct GameDome dome; - short stereoflag, stereomode; - float eyeseparation; - RecastData recastData; - - - /* physics (it was in world)*/ - float gravity; /*Gravitation constant for the game world*/ - - /* - * Radius of the activity bubble, in Manhattan length. Objects - * outside the box are activity-culled. */ - float activityBoxRadius; - - /* - * bit 3: (gameengine): Activity culling is enabled. - * bit 5: (gameengine) : enable Bullet DBVT tree for view frustum culling - */ - int flag; - short mode, matmode; - short occlusionRes; /* resolution of occlusion Z buffer in pixel */ - short physicsEngine; - short exitkey; - short vsync; /* Controls vsync: off, on, or adaptive (if supported) */ - short ticrate, maxlogicstep, physubstep, maxphystep; - short obstacleSimulation; - short raster_storage; - float levelHeight; - float deactivationtime, lineardeactthreshold, angulardeactthreshold; - - /* Scene LoD */ - short lodflag, pad2; - int scehysteresis, pad5; - -} GameData; - -/* GameData.stereoflag */ -#define STEREO_NOSTEREO 1 -#define STEREO_ENABLED 2 -#define STEREO_DOME 3 - -/* GameData.stereomode */ -//#define STEREO_NOSTEREO 1 -#define STEREO_QUADBUFFERED 2 -#define STEREO_ABOVEBELOW 3 -#define STEREO_INTERLACED 4 -#define STEREO_ANAGLYPH 5 -#define STEREO_SIDEBYSIDE 6 -#define STEREO_VINTERLACE 7 -//#define STEREO_DOME 8 -#define STEREO_3DTVTOPBOTTOM 9 - -/* GameData.physicsEngine */ -#define WOPHY_NONE 0 -#define WOPHY_BULLET 5 - -/* obstacleSimulation */ -#define OBSTSIMULATION_NONE 0 -#define OBSTSIMULATION_TOI_rays 1 -#define OBSTSIMULATION_TOI_cells 2 - -/* GameData.raster_storage */ -#define RAS_STORE_AUTO 0 -/* #define RAS_STORE_IMMEDIATE 1 */ /* DEPRECATED */ -#define RAS_STORE_VA 2 -#define RAS_STORE_VBO 3 - -/* GameData.vsync */ -#define VSYNC_ON 0 -#define VSYNC_OFF 1 -#define VSYNC_ADAPTIVE 2 - -/* GameData.flag */ -#define GAME_RESTRICT_ANIM_UPDATES (1 << 0) -#define GAME_ENABLE_ALL_FRAMES (1 << 1) -#define GAME_SHOW_DEBUG_PROPS (1 << 2) -#define GAME_SHOW_FRAMERATE (1 << 3) -#define GAME_SHOW_PHYSICS (1 << 4) -// #define GAME_DISPLAY_LISTS (1 << 5) /* deprecated */ -#define GAME_GLSL_NO_LIGHTS (1 << 6) -#define GAME_GLSL_NO_SHADERS (1 << 7) -#define GAME_GLSL_NO_SHADOWS (1 << 8) -#define GAME_GLSL_NO_RAMPS (1 << 9) -#define GAME_GLSL_NO_NODES (1 << 10) -#define GAME_GLSL_NO_EXTRA_TEX (1 << 11) -#define GAME_IGNORE_DEPRECATION_WARNINGS (1 << 12) -#define GAME_ENABLE_ANIMATION_RECORD (1 << 13) -#define GAME_SHOW_MOUSE (1 << 14) -#define GAME_GLSL_NO_COLOR_MANAGEMENT (1 << 15) -#define GAME_SHOW_OBSTACLE_SIMULATION (1 << 16) -#define GAME_NO_MATERIAL_CACHING (1 << 17) -#define GAME_GLSL_NO_ENV_LIGHTING (1 << 18) -/* Note: GameData.flag is now an int (max 32 flags). A short could only take 16 flags */ - -/* GameData.playerflag */ -#define GAME_PLAYER_FULLSCREEN (1 << 0) -#define GAME_PLAYER_DESKTOP_RESOLUTION (1 << 1) - -/* GameData.matmode */ -enum { -#ifdef DNA_DEPRECATED - GAME_MAT_TEXFACE = 0, /* deprecated */ -#endif - GAME_MAT_MULTITEX = 1, - GAME_MAT_GLSL = 2, -}; - -/* GameData.lodflag */ -#define SCE_LOD_USE_HYST (1 << 0) - /* UV Paint */ /* ToolSettings.uv_sculpt_settings */ #define UV_SCULPT_LOCK_BORDERS 1 @@ -1678,10 +1497,6 @@ typedef struct Scene { /* User-Defined KeyingSets */ int active_keyingset; /* index of the active KeyingSet. first KeyingSet has index 1, 'none' active is 0, 'add new' is -1 */ ListBase keyingsets; /* KeyingSets for this scene */ - - /* Game Settings */ - struct GameFraming framing DNA_DEPRECATED; // XXX deprecated since 2.5 - struct GameData gm; /* Units */ struct UnitSettings unit; @@ -1716,8 +1531,6 @@ typedef struct Scene { IDProperty *collection_properties; /* settings to be overriden by layer collections */ IDProperty *layer_properties; /* settings to be override by workspaces */ - int pad5[2]; - ViewRender view_render; } Scene; @@ -1910,7 +1723,6 @@ enum { /* RenderData.engine (scene.c) */ extern const char *RE_engine_id_BLENDER_RENDER; -extern const char *RE_engine_id_BLENDER_GAME; extern const char *RE_engine_id_BLENDER_CLAY; extern const char *RE_engine_id_BLENDER_EEVEE; extern const char *RE_engine_id_BLENDER_WORKBENCH; diff --git a/source/blender/makesdna/DNA_sensor_types.h b/source/blender/makesdna/DNA_sensor_types.h deleted file mode 100644 index 37064854920..00000000000 --- a/source/blender/makesdna/DNA_sensor_types.h +++ /dev/null @@ -1,334 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file DNA_sensor_types.h - * \ingroup DNA - * \since mar-2001 - * \author nzc - * - * #bSensor type is specifically for use by Object logic-bricks in the game-engine. - */ - -#ifndef __DNA_SENSOR_TYPES_H__ -#define __DNA_SENSOR_TYPES_H__ - -struct Object; -struct Material; - -/* ****************** SENSORS ********************* */ - -typedef struct bNearSensor { - char name[64]; /* MAX_NAME */ - float dist, resetdist; - int lastval, pad; -} bNearSensor; - -/** - * Defines the settings of a mouse sensor. - */ -typedef struct bMouseSensor { - /** - * The type of key this sensor listens to. - */ - short type; - short flag; - short pad1; - short mode; /* flag to choose material or property */ - char propname[64]; - char matname[64]; -} bMouseSensor; - -/* DEPRECATED */ -typedef struct bTouchSensor { - char name[64]; /* MAX_NAME */ - struct Material *ma; - float dist, pad; -} bTouchSensor; - -typedef struct bKeyboardSensor { - short key, qual; - short type, qual2; - /** - * Name of the target property - */ - char targetName[64]; /* MAX_NAME */ - /** - * Name of the toggle property - */ - char toggleName[64]; /* MAX_NAME */ -} bKeyboardSensor; - -typedef struct bPropertySensor { - int type; - int pad; - char name[64]; /* MAX_NAME */ - char value[64]; - char maxvalue[64]; -} bPropertySensor; - -typedef struct bActuatorSensor { - int type; - int pad; - char name[64]; /* MAX_NAME */ -} bActuatorSensor; - -typedef struct bDelaySensor { - short delay; - short duration; - short flag; - short pad; -} bDelaySensor; - -typedef struct bCollisionSensor { - char name[64]; /* property name. MAX_NAME */ - char materialName[64]; /* material */ - // struct Material *ma; // XXX remove materialName - short damptimer, damp; - short mode; /* flag to choose material or property */ - short pad2; -} bCollisionSensor; - -typedef struct bRadarSensor { - char name[64]; /* MAX_NAME */ - float angle; - float range; - short flag, axis; -} bRadarSensor; - -typedef struct bRandomSensor { - char name[64]; /* MAX_NAME */ - int seed; - int delay; -} bRandomSensor; - -typedef struct bRaySensor { - char name[64]; /* MAX_NAME */ - float range; - char propname[64]; - char matname[64]; - //struct Material *ma; // XXX remove materialName - short mode; - short pad1; - int axisflag; -} bRaySensor; - -typedef struct bArmatureSensor { - char posechannel[64]; /* MAX_NAME */ - char constraint[64]; /* MAX_NAME */ - int type; - float value; -} bArmatureSensor; - -typedef struct bMessageSensor { - /** - * (Possible future use) pointer to a single sender object - */ - struct Object *fromObject; - - /** - * Can be used to filter on subjects like this - */ - char subject[64]; - - /** - * (Possible future use) body to filter on - */ - char body[64]; -} bMessageSensor; - -typedef struct bSensor { - struct bSensor *next, *prev; - /* pulse and freq are the bool toggle and frame count for pulse mode */ - short type, otype, flag, pulse; - short freq, totlinks, pad1, pad2; /* freq makes reference to skipped ticks between 2 active pulses */ - char name[64]; /* MAX_NAME */ - void *data; - - struct bController **links; - - struct Object *ob; - - /* just add here, to avoid align errors... */ - short invert; /* Whether or not to invert the output. */ - short level; /* Whether the sensor is level base (edge by default) */ - short tap; - short pad; -} bSensor; - -typedef struct bJoystickSensor { - char name[64]; /* MAX_NAME */ - char type; - char joyindex; - short flag; - short axis; - short axis_single; - int axisf; - int button; - int hat; - int hatf; - int precision; -} bJoystickSensor; - -/* bMouseSensor->type: uses blender event defines */ - -/* bMouseSensor->flag: only pulse for now */ -#define SENS_MOUSE_FOCUS_PULSE 1 - -/* propertysensor->type */ -#define SENS_PROP_EQUAL 0 -#define SENS_PROP_NEQUAL 1 -#define SENS_PROP_INTERVAL 2 -#define SENS_PROP_CHANGED 3 -#define SENS_PROP_EXPRESSION 4 -#define SENS_PROP_LESSTHAN 5 -#define SENS_PROP_GREATERTHAN 6 - -/* raysensor->axisflag */ -/* flip x and y to make y default!!! */ -#define SENS_RAY_X_AXIS 1 -#define SENS_RAY_Y_AXIS 0 -#define SENS_RAY_Z_AXIS 2 -#define SENS_RAY_NEG_X_AXIS 3 -#define SENS_RAY_NEG_Y_AXIS 4 -#define SENS_RAY_NEG_Z_AXIS 5 -//#define SENS_RAY_NEGATIVE_AXIS 1 - -/* bRadarSensor->axis */ -#define SENS_RADAR_X_AXIS 0 -#define SENS_RADAR_Y_AXIS 1 -#define SENS_RADAR_Z_AXIS 2 -#define SENS_RADAR_NEG_X_AXIS 3 -#define SENS_RADAR_NEG_Y_AXIS 4 -#define SENS_RADAR_NEG_Z_AXIS 5 - -/* bMessageSensor->type */ -#define SENS_MESG_MESG 0 -#define SENS_MESG_PROP 1 - -/* bArmatureSensor->type */ -#define SENS_ARM_STATE_CHANGED 0 -#define SENS_ARM_LIN_ERROR_BELOW 1 -#define SENS_ARM_LIN_ERROR_ABOVE 2 -#define SENS_ARM_ROT_ERROR_BELOW 3 -#define SENS_ARM_ROT_ERROR_ABOVE 4 -/* update this when adding new type */ -#define SENS_ARM_MAXTYPE 4 - -/* sensor->type */ -#define SENS_ALWAYS 0 -#define SENS_TOUCH 1 /* DEPRECATED */ -#define SENS_NEAR 2 -#define SENS_KEYBOARD 3 -#define SENS_PROPERTY 4 -#define SENS_MOUSE 5 -#define SENS_COLLISION 6 -#define SENS_RADAR 7 -#define SENS_RANDOM 8 -#define SENS_RAY 9 -#define SENS_MESSAGE 10 -#define SENS_JOYSTICK 11 -#define SENS_ACTUATOR 12 -#define SENS_DELAY 13 -#define SENS_ARMATURE 14 -/* sensor->flag */ -#define SENS_SHOW 1 -#define SENS_DEL 2 -#define SENS_NEW 4 -#define SENS_NOT 8 -#define SENS_VISIBLE 16 -#define SENS_PIN 32 -#define SENS_DEACTIVATE 64 - -/* sensor->pulse */ -#define SENS_PULSE_CONT 0 -#define SENS_PULSE_REPEAT 1 -//#define SENS_PULSE_ONCE 2 -#define SENS_NEG_PULSE_MODE 4 - -/* sensor->suppress */ -#define SENS_SUPPRESS_POSITIVE (1 << 0) -#define SENS_SUPPRESS_NEGATIVE (1 << 1) - -/* collision, ray sensor modes: */ -/* A little bit fake: when property is active, the first bit is - * reset. Bite me :) So we don't actually use it, so we comment it out - * ... The reason for this is that we need to be backward compatible, - * and have a proper default value for this thing. - * */ -#define SENS_COLLISION_PROPERTY 0 -#define SENS_COLLISION_MATERIAL 1 -#define SENS_COLLISION_PULSE 2 - -/* ray specific mode */ -/* X-Ray means that the ray will traverse objects that don't have the property/material */ -#define SENS_RAY_PROPERTY 0 -#define SENS_RAY_MATERIAL 1 -#define SENS_RAY_XRAY 2 - -/* Some stuff for the mouse sensor Type: */ -#define BL_SENS_MOUSE_LEFT_BUTTON 1 -#define BL_SENS_MOUSE_MIDDLE_BUTTON 2 -#define BL_SENS_MOUSE_RIGHT_BUTTON 4 -#define BL_SENS_MOUSE_WHEEL_UP 5 -#define BL_SENS_MOUSE_WHEEL_DOWN 6 -#define BL_SENS_MOUSE_MOVEMENT 8 -#define BL_SENS_MOUSE_MOUSEOVER 16 -#define BL_SENS_MOUSE_MOUSEOVER_ANY 32 - -/* Joystick sensor - sorted by axis types */ -#define SENS_JOY_ANY_EVENT 1 - -#define SENS_JOY_BUTTON 0 /* axis type */ - -#define SENS_JOY_AXIS 1 /* axis type */ -#define SENS_JOY_X_AXIS 0 -#define SENS_JOY_Y_AXIS 1 -#define SENS_JOY_NEG_X_AXIS 2 -#define SENS_JOY_NEG_Y_AXIS 3 -#define SENS_JOY_PRECISION 4 - -#define SENS_JOY_HAT 2 /* axis type */ -#define SENS_JOY_HAT_DIR 0 -#define SENS_JOY_HAT_UP 1 -#define SENS_JOY_HAT_RIGHT 2 -#define SENS_JOY_HAT_DOWN 4 -#define SENS_JOY_HAT_LEFT 8 - -#define SENS_JOY_HAT_UP_RIGHT SENS_JOY_HAT_UP | SENS_JOY_HAT_RIGHT -#define SENS_JOY_HAT_DOWN_RIGHT SENS_JOY_HAT_DOWN | SENS_JOY_HAT_RIGHT -#define SENS_JOY_HAT_UP_LEFT SENS_JOY_HAT_UP | SENS_JOY_HAT_LEFT -#define SENS_JOY_HAT_DOWN_LEFT SENS_JOY_HAT_DOWN | SENS_JOY_HAT_LEFT - - -#define SENS_JOY_AXIS_SINGLE 3 /* axis type */ - - -#define SENS_DELAY_REPEAT 1 -// should match JOYINDEX_MAX in SCA_JoystickDefines.h */ -#define SENS_JOY_MAXINDEX 8 - -#endif /* __DNA_SENSOR_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 077ac4f7aa3..d763c7ca4f9 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -146,7 +146,7 @@ typedef struct SpaceButs { #define CONTEXT_SHADING 3 #define CONTEXT_EDITING 4 #define CONTEXT_SCRIPT 5 -#define CONTEXT_LOGIC 6 +//#define CONTEXT_LOGIC 6 /* sbuts->mainb old (deprecated) */ #ifdef DNA_DEPRECATED_ALLOW @@ -158,7 +158,7 @@ typedef struct SpaceButs { #define BUTS_WORLD 5 #define BUTS_RENDER 6 #define BUTS_EDIT 7 -#define BUTS_GAME 8 +// #define BUTS_GAME 8 #define BUTS_FPAINT 9 #define BUTS_RADIO 10 #define BUTS_SCRIPT 11 @@ -1243,23 +1243,6 @@ enum { SNODE_INSERTOFS_DIR_LEFT = 1, }; -/* Game Logic Editor ===================================== */ - -/* Logic Editor */ -typedef struct SpaceLogic { - SpaceLink *next, *prev; - ListBase regionbase; /* storage of regions for inactive spaces */ - int spacetype; - float blockscale DNA_DEPRECATED; - - short blockhandler[8] DNA_DEPRECATED; - - short flag, scaflag; - int pad; - - struct bGPdata *gpd; /* grease-pencil data */ -} SpaceLogic; - /* Console ================================================ */ /* Console content */ @@ -1432,7 +1415,7 @@ typedef enum eSpace_Type { SPACE_SCRIPT = 14, /* Deprecated */ SPACE_TIME = 15, SPACE_NODE = 16, - SPACE_LOGIC = 17, + SPACE_LOGIC = 17, /* deprecated */ SPACE_CONSOLE = 18, SPACE_USERPREF = 19, SPACE_CLIP = 20, diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 3da0bdb6ca2..1eb17b49cfd 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -397,7 +397,6 @@ typedef struct bTheme { ThemeSpace toops; ThemeSpace ttime; ThemeSpace tnode; - ThemeSpace tlogic; ThemeSpace tuserpref; ThemeSpace tconsole; ThemeSpace tclip; @@ -466,7 +465,7 @@ typedef struct UserDef { short versions; short dbl_click_time; - short gameflags; + short pad; short wheellinescroll; int uiflag; /* eUserpref_UI_Flag */ int uiflag2; /* eUserpref_UI_Flag2 */ @@ -568,7 +567,7 @@ typedef struct UserDef { float gpencil_new_layer_col[4]; /* default color for newly created Grease Pencil layers */ short tweak_threshold; - char navigation_mode, pad; + char navigation_mode, pad10; char author[80]; /* author name for file formats supporting it */ @@ -787,15 +786,6 @@ typedef enum eDupli_ID_Flags { USER_DUP_PSYS = (1 << 11) } eDupli_ID_Flags; -/* UserDef.gameflags */ -typedef enum eOpenGL_RenderingOptions { - USER_GL_RENDER_DEPRECATED_0 = (1 << 0), - USER_GL_RENDER_DEPRECATED_1 = (1 << 1), - USER_DISABLE_MIPMAP = (1 << 2), - USER_GL_RENDER_DEPRECATED_3 = (1 << 3), - USER_GL_RENDER_DEPRECATED_4 = (1 << 4), -} eOpenGL_RenderingOptions; - /* selection method for opengl gpu_select_method */ typedef enum eOpenGL_SelectOptions { USER_SELECT_AUTO = 0, diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 619f9fd4f6e..cc0389ec568 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -270,7 +270,7 @@ typedef struct View3D { #define RV3D_CLIPPING 4 #define RV3D_NAVIGATING 8 #define RV3D_GPULIGHT_UPDATE 16 -#define RV3D_IS_GAME_ENGINE 32 /* runtime flag, used to check if LoD's should be used */ +/*#define RV3D_IS_GAME_ENGINE 32 *//* UNUSED */ /** * Disable zbuffer offset, skip calls to #ED_view3d_polygon_offset. * Use when precise surface depth is needed and picking bias isn't, see T45434). diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index 3361e50e257..f30ffa84b73 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -47,8 +47,7 @@ struct MTex; /** * World defines general modeling data such as a background fill, - * gravity, color model etc. It mixes game-data, rendering - * data and modeling data. */ + * gravity, color model etc. It mixes rendering data and modeling data. */ typedef struct World { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ @@ -67,16 +66,6 @@ typedef struct World { */ float exposure, exp, range; float linfac, logfac; - - /** - * Gravitation constant for the game world - */ - float gravity; // XXX moved to scene->gamedata in 2.5 - - /** - * Radius of the activity bubble, in Manhattan length. Objects - * outside the box are activity-culled. */ - float activityBoxRadius; // XXX moved to scene->gamedata in 2.5 short skytype; /** @@ -89,16 +78,10 @@ typedef struct World { * bit 5: (gameengine) : enable Bullet DBVT tree for view frustum culling */ short mode; // partially moved to scene->gamedata in 2.5 - short occlusionRes; /* resolution of occlusion Z buffer in pixel */ // XXX moved to scene->gamedata in 2.5 - short physicsEngine; /* here it's aligned */ // XXX moved to scene->gamedata in 2.5 - short ticrate, maxlogicstep, physubstep, maxphystep; // XXX moved to scene->gamedata in 2.5 - + short pad2[2]; + float misi, miststa, mistdist, misthi; - - float starr DNA_DEPRECATED, starg DNA_DEPRECATED, starb DNA_DEPRECATED, stark DNA_DEPRECATED; /* Deprecated */ - float starsize DNA_DEPRECATED, starmindist DNA_DEPRECATED; - float stardist DNA_DEPRECATED, starcolnoise DNA_DEPRECATED; - + /* unused now: DOF */ short dofsta, dofend, dofmin, dofmax; @@ -147,9 +130,9 @@ typedef struct World { #define WO_MIST 1 //#define WO_STARS 2 /* deprecated */ /*#define WO_DOF 4*/ -#define WO_ACTIVITY_CULLING 8 +//#define WO_ACTIVITY_CULLING 8 /* deprecated */ #define WO_ENV_LIGHT 16 -#define WO_DBVT_CULLING 32 +//#define WO_DBVT_CULLING 32 /* deprecated */ #define WO_AMB_OCC 64 #define WO_INDIRECT_LIGHT 128 diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index f0f1c2210f0..d276e2c0859 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -100,10 +100,6 @@ static const char *includefiles[] = { "DNA_sequence_types.h", "DNA_effect_types.h", "DNA_outliner_types.h", - "DNA_property_types.h", - "DNA_sensor_types.h", - "DNA_controller_types.h", - "DNA_actuator_types.h", "DNA_sound_types.h", "DNA_group_types.h", "DNA_armature_types.h", @@ -1327,10 +1323,6 @@ int main(int argc, char **argv) #include "DNA_sequence_types.h" #include "DNA_effect_types.h" #include "DNA_outliner_types.h" -#include "DNA_property_types.h" -#include "DNA_sensor_types.h" -#include "DNA_controller_types.h" -#include "DNA_actuator_types.h" #include "DNA_sound_types.h" #include "DNA_group_types.h" #include "DNA_armature_types.h" diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 562855c01cc..d991e28a648 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -277,14 +277,6 @@ extern StructRNA RNA_GPencilStroke; extern StructRNA RNA_GPencilStrokePoint; extern StructRNA RNA_GPencilSculptSettings; extern StructRNA RNA_GPencilSculptBrush; -extern StructRNA RNA_GameBooleanProperty; -extern StructRNA RNA_GameFloatProperty; -extern StructRNA RNA_GameIntProperty; -extern StructRNA RNA_GameObjectSettings; -extern StructRNA RNA_GameProperty; -extern StructRNA RNA_GameSoftBodySettings; -extern StructRNA RNA_GameStringProperty; -extern StructRNA RNA_GameTimerProperty; extern StructRNA RNA_GaussianBlurSequence; extern StructRNA RNA_GlowSequence; extern StructRNA RNA_GreasePencil; @@ -521,7 +513,6 @@ extern StructRNA RNA_RigidBodyObject; extern StructRNA RNA_RigidBodyJointConstraint; extern StructRNA RNA_SPHFluidSettings; extern StructRNA RNA_Scene; -extern StructRNA RNA_SceneGameData; extern StructRNA RNA_SceneRenderLayer; extern StructRNA RNA_SceneSequence; extern StructRNA RNA_SceneObjects; @@ -591,7 +582,6 @@ extern StructRNA RNA_SpaceFileBrowser; extern StructRNA RNA_SpaceGraphEditor; extern StructRNA RNA_SpaceImageEditor; extern StructRNA RNA_SpaceInfo; -extern StructRNA RNA_SpaceLogicEditor; extern StructRNA RNA_SpaceNLA; extern StructRNA RNA_SpaceNodeEditor; extern StructRNA RNA_SpaceOutliner; diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 345c47ae1bf..0c0a22cc467 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -165,8 +165,6 @@ extern const EnumPropertyItem rna_enum_property_type_items[]; extern const EnumPropertyItem rna_enum_property_subtype_items[]; extern const EnumPropertyItem rna_enum_property_unit_items[]; -extern const EnumPropertyItem rna_enum_gameproperty_type_items[]; - extern const EnumPropertyItem rna_enum_viewport_shade_items[]; extern const EnumPropertyItem rna_enum_navigation_mode_items[]; diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 74c36c456b0..5e815e16a82 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -32,7 +32,6 @@ endif() set(DEFSRC rna_ID.c rna_action.c - rna_actuator.c rna_animation.c rna_animviz.c rna_armature.c @@ -44,7 +43,6 @@ set(DEFSRC rna_color.c rna_constraint.c rna_context.c - rna_controller.c rna_curve.c rna_depsgraph.c rna_dynamicpaint.c @@ -74,14 +72,12 @@ set(DEFSRC rna_particle.c rna_pose.c rna_lightprobe.c - rna_property.c rna_render.c rna_rigidbody.c rna_rna.c rna_scene.c rna_screen.c rna_sculpt_paint.c - rna_sensor.c rna_sequencer.c rna_smoke.c rna_sound.c @@ -103,11 +99,9 @@ set(DEFSRC set(APISRC rna_action_api.c - rna_actuator_api.c rna_animation_api.c rna_armature_api.c rna_camera_api.c - rna_controller_api.c rna_curve_api.c rna_fcurve_api.c rna_image_api.c @@ -120,7 +114,6 @@ set(APISRC rna_object_api.c rna_pose_api.c rna_scene_api.c - rna_sensor_api.c rna_sequencer_api.c rna_sound_api.c rna_space_api.c @@ -193,10 +186,6 @@ if(WITH_PYTHON) ) endif() -if(WITH_GAMEENGINE) - add_definitions(-DWITH_GAMEENGINE) -endif() - if(WITH_CLAY_ENGINE) add_definitions(-DWITH_CLAY_ENGINE) endif() diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 9745ca39872..40028eec4c8 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3350,7 +3350,6 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_action.c", "rna_action_api.c", RNA_def_action}, {"rna_animation.c", "rna_animation_api.c", RNA_def_animation}, {"rna_animviz.c", NULL, RNA_def_animviz}, - {"rna_actuator.c", "rna_actuator_api.c", RNA_def_actuator}, {"rna_armature.c", "rna_armature_api.c", RNA_def_armature}, {"rna_boid.c", NULL, RNA_def_boid}, {"rna_brush.c", NULL, RNA_def_brush}, @@ -3360,7 +3359,6 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_color.c", NULL, RNA_def_color}, {"rna_constraint.c", NULL, RNA_def_constraint}, {"rna_context.c", NULL, RNA_def_context}, - {"rna_controller.c", "rna_controller_api.c", RNA_def_controller}, {"rna_curve.c", "rna_curve_api.c", RNA_def_curve}, {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint}, {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, @@ -3388,13 +3386,11 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_particle.c", NULL, RNA_def_particle}, {"rna_pose.c", "rna_pose_api.c", RNA_def_pose}, {"rna_lightprobe.c", NULL, RNA_def_lightprobe}, - {"rna_property.c", NULL, RNA_def_gameproperty}, {"rna_render.c", NULL, RNA_def_render}, {"rna_rigidbody.c", NULL, RNA_def_rigidbody}, {"rna_scene.c", "rna_scene_api.c", RNA_def_scene}, {"rna_screen.c", NULL, RNA_def_screen}, {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint}, - {"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", "rna_space_api.c", RNA_def_space}, diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c deleted file mode 100644 index 26ec813a14f..00000000000 --- a/source/blender/makesrna/intern/rna_actuator.c +++ /dev/null @@ -1,2220 +0,0 @@ -/* - * ***** 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_actuator.c - * \ingroup RNA - */ - - -#include <stdlib.h> - -#include "DNA_constraint_types.h" -#include "DNA_object_types.h" -#include "DNA_actuator_types.h" -#include "DNA_scene_types.h" /* for MAXFRAME */ - -#include "BLI_math.h" -#include "BLI_string_utils.h" -#include "BLI_utildefines.h" - -#include "BLT_translation.h" - -#include "RNA_define.h" -#include "RNA_access.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - -#include "WM_types.h" - -/* Always keep in alphabetical order */ -static const EnumPropertyItem actuator_type_items[] = { - {ACT_ACTION, "ACTION", 0, "Action", ""}, - {ACT_ARMATURE, "ARMATURE", 0, "Armature", ""}, - {ACT_CAMERA, "CAMERA", 0, "Camera", ""}, - {ACT_CONSTRAINT, "CONSTRAINT", 0, "Constraint", ""}, - {ACT_EDIT_OBJECT, "EDIT_OBJECT", 0, "Edit Object", ""}, - {ACT_2DFILTER, "FILTER_2D", 0, "Filter 2D", ""}, - {ACT_GAME, "GAME", 0, "Game", ""}, - {ACT_MESSAGE, "MESSAGE", 0, "Message", ""}, - {ACT_OBJECT, "MOTION", 0, "Motion", ""}, - {ACT_MOUSE, "MOUSE", 0, "Mouse", ""}, - {ACT_PARENT, "PARENT", 0, "Parent", ""}, - {ACT_PROPERTY, "PROPERTY", 0, "Property", ""}, - {ACT_RANDOM, "RANDOM", 0, "Random", ""}, - {ACT_SCENE, "SCENE", 0, "Scene", ""}, - {ACT_SOUND, "SOUND", 0, "Sound", ""}, - {ACT_STATE, "STATE", 0, "State", ""}, - {ACT_STEERING, "STEERING", 0, "Steering", ""}, - {ACT_VISIBILITY, "VISIBILITY", 0, "Visibility", ""}, - {0, NULL, 0, NULL, NULL} -}; - -#ifdef RNA_RUNTIME - -#include "BKE_sca.h" - -static StructRNA *rna_Actuator_refine(struct PointerRNA *ptr) -{ - bActuator *actuator = (bActuator *)ptr->data; - - switch (actuator->type) { - case ACT_ACTION: - return &RNA_ActionActuator; - case ACT_OBJECT: - return &RNA_ObjectActuator; - case ACT_CAMERA: - return &RNA_CameraActuator; - case ACT_SOUND: - return &RNA_SoundActuator; - case ACT_PROPERTY: - return &RNA_PropertyActuator; - case ACT_CONSTRAINT: - return &RNA_ConstraintActuator; - case ACT_EDIT_OBJECT: - return &RNA_EditObjectActuator; - case ACT_SCENE: - return &RNA_SceneActuator; - case ACT_RANDOM: - return &RNA_RandomActuator; - case ACT_MESSAGE: - return &RNA_MessageActuator; - case ACT_GAME: - return &RNA_GameActuator; - case ACT_VISIBILITY: - return &RNA_VisibilityActuator; - case ACT_2DFILTER: - return &RNA_Filter2DActuator; - case ACT_PARENT: - return &RNA_ParentActuator; - case ACT_STATE: - return &RNA_StateActuator; - case ACT_ARMATURE: - return &RNA_ArmatureActuator; - case ACT_STEERING: - return &RNA_SteeringActuator; - case ACT_MOUSE: - return &RNA_MouseActuator; - default: - return &RNA_Actuator; - } -} - -static void rna_Actuator_name_set(PointerRNA *ptr, const char *value) -{ - Object *ob = ptr->id.data; - bActuator *act = ptr->data; - BLI_strncpy_utf8(act->name, value, sizeof(act->name)); - BLI_uniquename(&ob->actuators, act, DATA_("Actuator"), '.', offsetof(bActuator, name), sizeof(act->name)); -} - -static void rna_Actuator_type_set(struct PointerRNA *ptr, int value) -{ - bActuator *act = (bActuator *)ptr->data; - - if (value != act->type) { - act->type = value; - init_actuator(act); - } -} - -static void rna_ConstraintActuator_type_set(struct PointerRNA *ptr, int value) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - - if (value != ca->type) { - ca->type = value; - switch (ca->type) { - case ACT_CONST_TYPE_ORI: - /* negative axis not supported in the orientation mode */ - if (ELEM(ca->mode, ACT_CONST_DIRNX, ACT_CONST_DIRNY, ACT_CONST_DIRNZ)) - ca->mode = ACT_CONST_NONE; - break; - - case ACT_CONST_TYPE_LOC: - case ACT_CONST_TYPE_DIST: - case ACT_CONST_TYPE_FH: - default: - break; - } - } -} - -static float rna_ConstraintActuator_limitmin_get(struct PointerRNA *ptr) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->flag & ACT_CONST_LOCX) fp = ca->minloc; - else if (ca->flag & ACT_CONST_LOCY) fp = ca->minloc + 1; - else if (ca->flag & ACT_CONST_LOCZ) fp = ca->minloc + 2; - else if (ca->flag & ACT_CONST_ROTX) fp = ca->minrot; - else if (ca->flag & ACT_CONST_ROTY) fp = ca->minrot + 1; - else fp = ca->minrot + 2; - - return *fp; -} - -static void rna_ConstraintActuator_limitmin_set(struct PointerRNA *ptr, float value) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->flag & ACT_CONST_LOCX) fp = ca->minloc; - else if (ca->flag & ACT_CONST_LOCY) fp = ca->minloc + 1; - else if (ca->flag & ACT_CONST_LOCZ) fp = ca->minloc + 2; - else if (ca->flag & ACT_CONST_ROTX) fp = ca->minrot; - else if (ca->flag & ACT_CONST_ROTY) fp = ca->minrot + 1; - else fp = ca->minrot + 2; - - *fp = value; -} - -static float rna_ConstraintActuator_limitmax_get(struct PointerRNA *ptr) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->flag & ACT_CONST_LOCX) fp = ca->maxloc; - else if (ca->flag & ACT_CONST_LOCY) fp = ca->maxloc + 1; - else if (ca->flag & ACT_CONST_LOCZ) fp = ca->maxloc + 2; - else if (ca->flag & ACT_CONST_ROTX) fp = ca->maxrot; - else if (ca->flag & ACT_CONST_ROTY) fp = ca->maxrot + 1; - else fp = ca->maxrot + 2; - - return *fp; -} - -static void rna_ConstraintActuator_limitmax_set(struct PointerRNA *ptr, float value) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->flag & ACT_CONST_LOCX) fp = ca->maxloc; - else if (ca->flag & ACT_CONST_LOCY) fp = ca->maxloc + 1; - else if (ca->flag & ACT_CONST_LOCZ) fp = ca->maxloc + 2; - else if (ca->flag & ACT_CONST_ROTX) fp = ca->maxrot; - else if (ca->flag & ACT_CONST_ROTY) fp = ca->maxrot + 1; - else fp = ca->maxrot + 2; - - *fp = value; -} - -static float rna_ConstraintActuator_distance_get(struct PointerRNA *ptr) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->mode & (ACT_CONST_DIRPX | ACT_CONST_DIRNX)) fp = ca->minloc; - else if (ca->mode & (ACT_CONST_DIRPY | ACT_CONST_DIRNY)) fp = ca->minloc + 1; - else fp = ca->minloc + 2; - - return *fp; -} - -static void rna_ConstraintActuator_distance_set(struct PointerRNA *ptr, float value) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->mode & (ACT_CONST_DIRPX | ACT_CONST_DIRNX)) fp = ca->minloc; - else if (ca->mode & (ACT_CONST_DIRPY | ACT_CONST_DIRNY)) fp = ca->minloc + 1; - else fp = ca->minloc + 2; - - *fp = value; -} - -static float rna_ConstraintActuator_range_get(struct PointerRNA *ptr) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->mode & (ACT_CONST_DIRPX | ACT_CONST_DIRNX)) fp = ca->maxloc; - else if (ca->mode & (ACT_CONST_DIRPY | ACT_CONST_DIRNY)) fp = ca->maxloc + 1; - else fp = ca->maxloc + 2; - - return *fp; -} - -static void rna_ConstraintActuator_range_set(struct PointerRNA *ptr, float value) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->mode & (ACT_CONST_DIRPX | ACT_CONST_DIRNX)) fp = ca->maxloc; - else if (ca->mode & (ACT_CONST_DIRPY | ACT_CONST_DIRNY)) fp = ca->maxloc + 1; - else fp = ca->maxloc + 2; - - *fp = value; -} - -static float rna_ConstraintActuator_fhheight_get(struct PointerRNA *ptr) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->mode & (ACT_CONST_DIRPX | ACT_CONST_DIRNX)) fp = ca->minloc; - else if (ca->mode & (ACT_CONST_DIRPY | ACT_CONST_DIRNY)) fp = ca->minloc + 1; - else fp = ca->minloc + 2; - - return *fp; -} - -static void rna_ConstraintActuator_fhheight_set(struct PointerRNA *ptr, float value) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->mode & (ACT_CONST_DIRPX | ACT_CONST_DIRNX)) fp = ca->minloc; - else if (ca->mode & (ACT_CONST_DIRPY | ACT_CONST_DIRNY)) fp = ca->minloc + 1; - else fp = ca->minloc + 2; - - *fp = value; -} - -static float rna_ConstraintActuator_spring_get(struct PointerRNA *ptr) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->mode & (ACT_CONST_DIRPX | ACT_CONST_DIRNX)) fp = ca->maxloc; - else if (ca->mode & (ACT_CONST_DIRPY | ACT_CONST_DIRNY)) fp = ca->maxloc + 1; - else fp = ca->maxloc + 2; - - return *fp; -} - -static void rna_ConstraintActuator_spring_set(struct PointerRNA *ptr, float value) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - float *fp; - - if (ca->mode & (ACT_CONST_DIRPX | ACT_CONST_DIRNX)) fp = ca->maxloc; - else if (ca->mode & (ACT_CONST_DIRPY | ACT_CONST_DIRNY)) fp = ca->maxloc + 1; - else fp = ca->maxloc + 2; - - *fp = value; -} -/* ConstraintActuator uses the same property for Material and Property. - * Therefore we need to clear the property when "use_material_detect" mode changes */ -static void rna_Actuator_constraint_detect_material_set(struct PointerRNA *ptr, int value) -{ - bActuator *act = (bActuator *)ptr->data; - bConstraintActuator *ca = act->data; - - short old_value = (ca->flag & ACT_CONST_MATERIAL) ? 1 : 0; - - if (old_value != value) { - ca->flag ^= ACT_CONST_MATERIAL; - ca->matprop[0] = '\0'; - } -} - -static void rna_ActionActuator_add_set(struct PointerRNA *ptr, int value) -{ - bActuator *act = (bActuator *)ptr->data; - bActionActuator *aa = act->data; - - if (value == 1) { - aa->flag &= ~ACT_IPOFORCE; - aa->flag |= ACT_IPOADD; - } - else { - aa->flag &= ~ACT_IPOADD; - } -} - -static void rna_ActionActuator_force_set(struct PointerRNA *ptr, int value) -{ - bActuator *act = (bActuator *)ptr->data; - bActionActuator *aa = act->data; - - if (value == 1) { - aa->flag &= ~ACT_IPOADD; - aa->flag |= ACT_IPOFORCE; - } - else { - aa->flag &= ~ACT_IPOFORCE; - } -} - -static void rna_ObjectActuator_type_set(struct PointerRNA *ptr, int value) -{ - bActuator *act = (bActuator *)ptr->data; - bObjectActuator *oa = act->data; - if (value != oa->type) { - oa->type = value; - switch (oa->type) { - case ACT_OBJECT_NORMAL: - memset(oa, 0, sizeof(bObjectActuator)); - oa->flag = ACT_FORCE_LOCAL | ACT_TORQUE_LOCAL | ACT_DLOC_LOCAL | ACT_DROT_LOCAL; - oa->type = ACT_OBJECT_NORMAL; - break; - - case ACT_OBJECT_SERVO: - memset(oa, 0, sizeof(bObjectActuator)); - oa->flag = ACT_LIN_VEL_LOCAL; - oa->type = ACT_OBJECT_SERVO; - oa->forcerot[0] = 30.0f; - oa->forcerot[1] = 0.5f; - oa->forcerot[2] = 0.0f; - break; - - case ACT_OBJECT_CHARACTER: - memset(oa, 0, sizeof(bObjectActuator)); - oa->flag = ACT_DLOC_LOCAL | ACT_DROT_LOCAL; - oa->type = ACT_OBJECT_CHARACTER; - break; - } - } -} - -static void rna_ObjectActuator_integralcoefficient_set(struct PointerRNA *ptr, float value) -{ - bActuator *act = (bActuator *)ptr->data; - bObjectActuator *oa = act->data; - - oa->forcerot[1] = value; - oa->forcerot[0] = 60.0f * oa->forcerot[1]; -} - -static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values) -{ - bActuator *act = (bActuator *)ptr->data; - bStateActuator *sa = act->data; - - int i, tot = 0; - - /* ensure we always have some state selected */ - for (i = 0; i < OB_MAX_STATES; i++) - if (values[i]) - tot++; - - if (tot == 0) - return; - - for (i = 0; i < OB_MAX_STATES; i++) { - if (values[i]) sa->mask |= (1 << i); - else sa->mask &= ~(1 << i); - } -} - -/* Always keep in alphabetical order */ -const EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) -{ - EnumPropertyItem *item = NULL; - Object *ob = NULL; - int totitem = 0; - - if (ptr->type == &RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)) { - ob = (Object *)ptr->id.data; - } - else { - /* can't use ob from ptr->id.data because that enum is also used by operators */ - ob = CTX_data_active_object(C); - } - - if (ob != NULL) { - if (ob->type == OB_ARMATURE) { - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ARMATURE); - } - } - - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ACTION); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CAMERA); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_CONSTRAINT); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_EDIT_OBJECT); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_2DFILTER); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_GAME); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_MESSAGE); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_MOUSE); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_OBJECT); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PARENT); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_PROPERTY); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_RANDOM); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SCENE); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_STEERING); - - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_SOUND); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_STATE); - RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_VISIBILITY); - - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; -} - -static void rna_Actuator_Armature_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - bActuator *act = (bActuator *)ptr->data; - bArmatureActuator *aa = act->data; - Object *ob = (Object *)ptr->id.data; - - char *posechannel = aa->posechannel; - char *constraint = aa->constraint; - - /* check that bone exist in the active object */ - if (ob->type == OB_ARMATURE && ob->pose) { - bPoseChannel *pchan; - bPose *pose = ob->pose; - for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { - if (STREQ(pchan->name, posechannel)) { - /* found it, now look for constraint channel */ - bConstraint *con; - for (con = pchan->constraints.first; con; con = con->next) { - if (STREQ(con->name, constraint)) { - /* found it, all ok */ - return; - } - } - /* didn't find constraint, make empty */ - constraint[0] = 0; - return; - } - } - } - /* didn't find any */ - posechannel[0] = 0; - constraint[0] = 0; -} - -static void rna_SteeringActuator_navmesh_set(PointerRNA *ptr, PointerRNA value) -{ - bActuator *act = (bActuator *)ptr->data; - bSteeringActuator *sa = (bSteeringActuator *) act->data; - - Object *obj = value.data; - if (obj && obj->body_type == OB_BODY_TYPE_NAVMESH) - sa->navmesh = obj; - else - sa->navmesh = NULL; -} - -/* note: the following set functions exists only to avoid id refcounting */ -static void rna_Actuator_editobject_mesh_set(PointerRNA *ptr, PointerRNA value) -{ - bActuator *act = (bActuator *)ptr->data; - bEditObjectActuator *eoa = (bEditObjectActuator *) act->data; - - eoa->me = value.data; -} - -#else - -static void rna_def_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "Actuator", NULL); - RNA_def_struct_ui_text(srna, "Actuator", "Actuator to apply actions in the game engine"); - RNA_def_struct_sdna(srna, "bActuator"); - RNA_def_struct_refine_func(srna, "rna_Actuator_refine"); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Name", ""); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Actuator_name_set"); - RNA_def_struct_name_property(srna, prop); - - prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_enum_items(prop, actuator_type_items); - RNA_def_property_enum_funcs(prop, NULL, "rna_Actuator_type_set", "rna_Actuator_type_itemf"); - RNA_def_property_ui_text(prop, "Type", ""); - - prop = RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_PIN); - RNA_def_property_ui_text(prop, "Pinned", "Display when not linked to a visible states controller"); - RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SHOW); - RNA_def_property_ui_text(prop, "Expanded", "Set actuator expanded in the user interface"); - RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); - - prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_DEACTIVATE); - RNA_def_property_ui_text(prop, "Active", "Set the active state of the actuator"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - RNA_api_actuator(srna); -} - -static void rna_def_action_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_ACTION_PLAY, "PLAY", 0, "Play", ""}, - {ACT_ACTION_PINGPONG, "PINGPONG", 0, "Ping Pong", ""}, - {ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""}, - {ACT_ACTION_LOOP_STOP, "LOOPSTOP", 0, "Loop Stop", ""}, - {ACT_ACTION_LOOP_END, "LOOPEND", 0, "Loop End", ""}, - {ACT_ACTION_FROM_PROP, "PROPERTY", 0, "Property", ""}, -#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR - {ACT_ACTION_MOTION, "MOTION", 0, "Displacement", ""}, -#endif - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_blend_items[] = { - {ACT_ACTION_BLEND, "BLEND", 0, "Blend", ""}, - {ACT_ACTION_ADD, "ADD", 0, "Add", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "ActionActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Action Actuator", "Actuator to control the object movement"); - RNA_def_struct_sdna_from(srna, "bActionActuator", "data"); - - prop = RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Action Type", "Action playback type"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "act"); - RNA_def_property_struct_type(prop, "Action"); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); - RNA_def_property_ui_text(prop, "Action", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "end_reset", 1); - RNA_def_property_ui_text(prop, "Continue", - "Restore last frame when switching on/off, otherwise play from the start each time"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sta"); - RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2); - RNA_def_property_ui_text(prop, "Start Frame", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "end"); - RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2); - RNA_def_property_ui_text(prop, "End Frame", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "blendin"); - RNA_def_property_range(prop, 0, 32767); - RNA_def_property_ui_text(prop, "Blendin", "Number of frames of motion blending"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "priority", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, 100); - RNA_def_property_ui_text(prop, "Priority", - "Execution priority - lower numbers will override actions with higher numbers " - "(with 2 or more actions at once, the overriding channels must be lower in the stack)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "layer", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, 32766); /* This should match BL_ActionManager::MAX_ACTION_LAYERS - 1 */ - RNA_def_property_ui_text(prop, "Layer", "The animation layer to play the action on"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "layer_weight", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Layer Weight", - "How much of the previous layer to blend into this one"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "frameProp"); - RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* booleans */ - prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD); - RNA_def_property_boolean_funcs(prop, NULL, "rna_ActionActuator_add_set"); - RNA_def_property_ui_text(prop, "Add", - "Action is added to the current loc/rot/scale in global or local coordinate according to " - "Local flag"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_force", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOFORCE); - RNA_def_property_boolean_funcs(prop, NULL, "rna_ActionActuator_force_set"); - RNA_def_property_ui_text(prop, "Force", - "Apply Action as a global or local force depending on the local option " - "(dynamic objects only)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOLOCAL); - RNA_def_property_ui_text(prop, "L", "Let the Action act in local coordinates, used in Force and Add mode"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOCHILD); - RNA_def_property_ui_text(prop, "Child", "Update Action on all children Objects as well"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "blend_mode"); - RNA_def_property_enum_items(prop, prop_blend_items); - RNA_def_property_ui_text(prop, "Blend Mode", "How this layer is blended with previous layers"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - -#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR - prop = RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "stridelength"); - RNA_def_property_range(prop, 0.0, 2500.0); - RNA_def_property_ui_text(prop, "Cycle", "Distance covered by a single cycle of the action"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -#endif -} - -static void rna_def_object_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple Motion", ""}, - {ACT_OBJECT_SERVO, "OBJECT_SERVO", 0, "Servo Control", ""}, - {ACT_OBJECT_CHARACTER, "OBJECT_CHARACTER", 0, "Character Motion", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "ObjectActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Motion Actuator", "Actuator to control the object movement"); - RNA_def_struct_sdna_from(srna, "bObjectActuator", "data"); - - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_enum_funcs(prop, NULL, "rna_ObjectActuator_type_set", NULL); - RNA_def_property_ui_text(prop, "Motion Type", "Specify the motion system"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_sdna(prop, NULL, "reference"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Reference Object", - "Reference object for velocity calculation, leave empty for world reference"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "damping", PROP_INT, PROP_NONE); - RNA_def_property_ui_range(prop, 0, 1000, 1, 1); - RNA_def_property_ui_text(prop, "Damping Frames", "Number of frames to reach the target velocity"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "proportional_coefficient", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "forcerot[0]"); - RNA_def_property_ui_range(prop, 0.0, 200.0, 10, 2); - RNA_def_property_ui_text(prop, "Proportional Coefficient", "Typical value is 60x integral coefficient"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "integral_coefficient", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "forcerot[1]"); - RNA_def_property_ui_range(prop, 0.0, 3.0, 10, 2); - RNA_def_property_float_funcs(prop, NULL, "rna_ObjectActuator_integralcoefficient_set", NULL); - RNA_def_property_ui_text(prop, "Integral Coefficient", - "Low value (0.01) for slow response, high value (0.5) for fast response"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "derivate_coefficient", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "forcerot[2]"); - RNA_def_property_ui_range(prop, -100.0, 100.0, 10, 2); - RNA_def_property_ui_text(prop, "Derivate Coefficient", "Not required, high values can cause instability"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Servo Limit */ - prop = RNA_def_property(srna, "force_max_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "dloc[0]"); - RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Max", "Upper limit for X force"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "force_min_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "drot[0]"); - RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Min", "Lower limit for X force"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "force_max_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "dloc[1]"); - RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Max", "Upper limit for Y force"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "force_min_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "drot[1]"); - RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Min", "Lower limit for Y force"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "force_max_z", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "dloc[2]"); - RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Max", "Upper limit for Z force"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "force_min_z", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "drot[2]"); - RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2); - RNA_def_property_ui_text(prop, "Min", "Lower limit for Z force"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* floats 3 Arrays*/ - prop = RNA_def_property(srna, "offset_location", PROP_FLOAT, PROP_XYZ); - RNA_def_property_float_sdna(prop, NULL, "dloc"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Loc", "Location"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "offset_rotation", PROP_FLOAT, PROP_EULER); - RNA_def_property_float_sdna(prop, NULL, "drot"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Rot", "Rotation"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "force", PROP_FLOAT, PROP_XYZ); - RNA_def_property_float_sdna(prop, NULL, "forceloc"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Force", "Force"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "torque", PROP_FLOAT, PROP_XYZ); - RNA_def_property_float_sdna(prop, NULL, "forcerot"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Torque", "Torque"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ); - RNA_def_property_float_sdna(prop, NULL, "linearvelocity"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Linear Velocity", - "Linear velocity (in Servo mode it sets the target relative linear velocity, it will be " - "achieved by automatic application of force - Null velocity is a valid target)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ); - RNA_def_property_float_sdna(prop, NULL, "angularvelocity"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* booleans */ - prop = RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_DLOC_LOCAL); - RNA_def_property_ui_text(prop, "L", "Location is defined in local coordinates"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_local_rotation", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_DROT_LOCAL); - RNA_def_property_ui_text(prop, "L", "Rotation is defined in local coordinates"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_local_force", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_FORCE_LOCAL); - RNA_def_property_ui_text(prop, "L", "Force is defined in local coordinates"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_local_torque", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TORQUE_LOCAL); - RNA_def_property_ui_text(prop, "L", "Torque is defined in local coordinates"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_LIN_VEL_LOCAL); - RNA_def_property_ui_text(prop, "L", "Velocity is defined in local coordinates"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ANG_VEL_LOCAL); - RNA_def_property_ui_text(prop, "L", "Angular velocity is defined in local coordinates"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_add_linear_velocity", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ADD_LIN_VEL); - RNA_def_property_ui_text(prop, "Add", "Toggles between ADD and SET linV"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_add_character_location", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ADD_CHAR_LOC); - RNA_def_property_ui_text(prop, "Add", "Toggle between ADD and SET character location"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_servo_limit_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_X); - RNA_def_property_ui_text(prop, "X", "Set limit to force along the X axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_servo_limit_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Y); - RNA_def_property_ui_text(prop, "Y", "Set limit to force along the Y axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_servo_limit_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Z); - RNA_def_property_ui_text(prop, "Z", "Set limit to force along the Z axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_character_jump", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CHAR_JUMP); - RNA_def_property_ui_text(prop, "Jump", "Make the character jump using the settings in the physics properties"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_camera_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_axis_items[] = { - {OB_POSX, "POS_X", 0, "+X", "Camera tries to get behind the X axis"}, - {OB_POSY, "POS_Y", 0, "+Y", "Camera tries to get behind the Y axis"}, - {OB_NEGX, "NEG_X", 0, "-X", "Camera tries to get behind the -X axis"}, - {OB_NEGY, "NEG_Y", 0, "-Y", "Camera tries to get behind the -Y axis"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "CameraActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Camera Actuator", ""); - RNA_def_struct_sdna_from(srna, "bCameraActuator", "data"); - - prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_sdna(prop, NULL, "ob"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Camera Object", "Look at this Object"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* floats */ - prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE); - RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2); - RNA_def_property_ui_text(prop, "Height", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE); - RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2); - RNA_def_property_ui_text(prop, "Min", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE); - RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2); - RNA_def_property_ui_text(prop, "Max", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "damping"); - RNA_def_property_range(prop, 0, 10.0); - RNA_def_property_ui_range(prop, 0, 5.0, 1, 2); - RNA_def_property_ui_text(prop, "Damping", "Strength of the constraint that drives the camera behind the target"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* +x/+y/-x/-y */ - prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "axis"); - RNA_def_property_enum_items(prop, prop_axis_items); - RNA_def_property_ui_text(prop, "Axis", "Axis the Camera will try to get behind"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_sound_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_SND_PLAY_STOP_SOUND, "PLAYSTOP", 0, "Play Stop", ""}, - {ACT_SND_PLAY_END_SOUND, "PLAYEND", 0, "Play End", ""}, - {ACT_SND_LOOP_STOP_SOUND, "LOOPSTOP", 0, "Loop Stop", ""}, - {ACT_SND_LOOP_END_SOUND, "LOOPEND", 0, "Loop End", ""}, - {ACT_SND_LOOP_BIDIRECTIONAL_SOUND, "LOOPBIDIRECTIONAL", 0, "Loop Bidirectional", ""}, - {ACT_SND_LOOP_BIDIRECTIONAL_STOP_SOUND, "LOOPBIDIRECTIONALSTOP", 0, "Loop Bidirectional Stop", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "SoundActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Sound Actuator", "Actuator to handle sound"); - RNA_def_struct_sdna_from(srna, "bSoundActuator", "data"); - - prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Sound"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_struct_ui_text(srna, "Sound", "Sound file"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Play Mode", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE); - RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2); - RNA_def_property_range(prop, 0.0, 2.0); - RNA_def_property_ui_text(prop, "Volume", "Initial volume of the sound"); - RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE); - RNA_def_property_ui_range(prop, -12.0, 12.0, 1, 2); - RNA_def_property_ui_text(prop, "Pitch", "Pitch of the sound"); - RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* floats - 3D Parameters */ - prop = RNA_def_property(srna, "gain_3d_min", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sound3D.min_gain"); - RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2); - RNA_def_property_ui_text(prop, "Minimum Gain", "The minimum gain of the sound, no matter how far it is away"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "gain_3d_max", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sound3D.max_gain"); - RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2); - RNA_def_property_ui_text(prop, "Maximum Gain", "The maximum gain of the sound, no matter how near it is"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "distance_3d_reference", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sound3D.reference_distance"); - RNA_def_property_ui_range(prop, 0.0, FLT_MAX, 1, 2); - RNA_def_property_ui_text(prop, "Reference Distance", "The distance where the sound has a gain of 1.0"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "distance_3d_max", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sound3D.max_distance"); - RNA_def_property_ui_range(prop, 0.0, FLT_MAX, 1, 2); - RNA_def_property_ui_text(prop, "Maximum Distance", "The maximum distance at which you can hear the sound"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "rolloff_factor_3d", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sound3D.rolloff_factor"); - RNA_def_property_ui_range(prop, 0.0, 5.0, 1, 2); - RNA_def_property_ui_text(prop, "Rolloff", "The influence factor on volume depending on distance"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "cone_outer_gain_3d", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_gain"); - RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2); - RNA_def_property_ui_text(prop, "Cone Outer Gain", - "The gain outside the outer cone (the gain in the outer cone will be interpolated " - "between this value and the normal gain in the inner cone)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "cone_outer_angle_3d", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_angle"); - RNA_def_property_ui_range(prop, 0.0, DEG2RADF(360.0f), 1, 2); - RNA_def_property_ui_text(prop, "Cone Outer Angle", "The angle of the outer cone"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "cone_inner_angle_3d", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_inner_angle"); - RNA_def_property_ui_range(prop, 0.0, DEG2RADF(360.0f), 1, 2); - RNA_def_property_ui_text(prop, "Cone Inner Angle", "The angle of the inner cone"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* booleans */ - prop = RNA_def_property(srna, "use_sound_3d", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SND_3D_SOUND); - RNA_def_property_ui_text(prop, "3D Sound", "Enable/Disable 3D Sound"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_property_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_PROP_ASSIGN, "ASSIGN", 0, "Assign", ""}, - {ACT_PROP_ADD, "ADD", 0, "Add", ""}, - {ACT_PROP_COPY, "COPY", 0, "Copy", ""}, - {ACT_PROP_TOGGLE, "TOGGLE", 0, "Toggle", "For bool/int/float/timer properties only"}, - {ACT_PROP_LEVEL, "LEVEL", 0, "Level", "For bool/int/float/timer properties only"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "PropertyActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Property Actuator", "Actuator to handle properties"); - RNA_def_struct_sdna_from(srna, "bPropertyActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Mode", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "Property", "The name of the property"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "value", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Value", "The name of the property or the value to use (use \"\" around strings)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Copy Mode */ - prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_sdna(prop, NULL, "ob"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Object", "Copy from this Object"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /*XXX add even magic'er property lookup (need to look for the property list of the target object) */ - prop = RNA_def_property(srna, "object_property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "value"); - RNA_def_property_ui_text(prop, "Property Name", "Copy this property"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_constraint_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""}, - {ACT_CONST_TYPE_DIST, "DIST", 0, "Distance Constraint", ""}, - {ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""}, - {ACT_CONST_TYPE_FH, "FH", 0, "Force Field Constraint", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_limit_items[] = { - {ACT_CONST_NONE, "NONE", 0, "None", ""}, - {ACT_CONST_LOCX, "LOCX", 0, "Loc X", ""}, - {ACT_CONST_LOCY, "LOCY", 0, "Loc Y", ""}, - {ACT_CONST_LOCZ, "LOCZ", 0, "Loc Z", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_direction_items[] = { - {ACT_CONST_NONE, "NONE", 0, "None", ""}, - {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""}, - {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""}, - {ACT_CONST_DIRPZ, "DIRPZ", 0, "Z axis", ""}, - {ACT_CONST_DIRNX, "DIRNX", 0, "-X axis", ""}, - {ACT_CONST_DIRNY, "DIRNY", 0, "-Y axis", ""}, - {ACT_CONST_DIRNZ, "DIRNZ", 0, "-Z axis", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_direction_pos_items[] = { - {ACT_CONST_NONE, "NONE", 0, "None", ""}, - {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""}, - {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""}, - {ACT_CONST_DIRPZ, "DIRPZ", 0, "Z axis", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "ConstraintActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to handle Constraints"); - RNA_def_struct_sdna_from(srna, "bConstraintActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_enum_funcs(prop, NULL, "rna_ConstraintActuator_type_set", NULL); - RNA_def_property_ui_text(prop, "Constraints Mode", "The type of the constraint"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "limit", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "flag"); - RNA_def_property_enum_items(prop, prop_limit_items); - RNA_def_property_ui_text(prop, "Limit", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "mode"); - RNA_def_property_enum_items(prop, prop_direction_items); - RNA_def_property_ui_text(prop, "Direction", "Direction of the ray"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "direction_axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "mode"); - RNA_def_property_enum_items(prop, prop_direction_items); - RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_CONST_TYPE_LOC */ - prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmin_get", - "rna_ConstraintActuator_limitmin_set", NULL); - RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2); - RNA_def_property_ui_text(prop, "Min", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmax_get", - "rna_ConstraintActuator_limitmax_set", NULL); - RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2); - RNA_def_property_ui_text(prop, "Max", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "damping", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "damp"); - RNA_def_property_ui_range(prop, 0, 100, 1, 1); - RNA_def_property_ui_text(prop, "Damping", "Damping factor: time constant (in frame) of low pass filter"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_CONST_TYPE_DIST */ - prop = RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_range_get", "rna_ConstraintActuator_range_set", NULL); - RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2); - RNA_def_property_ui_text(prop, "Range", "Maximum length of ray"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get", - "rna_ConstraintActuator_distance_set", NULL); - RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2); - RNA_def_property_ui_text(prop, "Distance", "Keep this distance to target"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /*XXX to use a pointer or add a material lookup */ - prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "matprop"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Material", "Ray detects only Objects with this material"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /*XXX add magic property lookup */ - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "matprop"); - RNA_def_property_ui_text(prop, "Property", "Ray detects only Objects with this property"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "time", PROP_INT, PROP_NONE); - RNA_def_property_ui_range(prop, 0, 1000, 1, 2); - RNA_def_property_ui_text(prop, "Time", "Maximum activation time in frame, 0 for unlimited"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "rotdamp"); - RNA_def_property_ui_range(prop, 0, 100, 1, 1); - RNA_def_property_ui_text(prop, "RotDamp", "Use a different damping for orientation"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_CONST_TYPE_ORI */ - prop = RNA_def_property(srna, "direction_axis_pos", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "mode"); - RNA_def_property_enum_items(prop, prop_direction_pos_items); - RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "rotation_max", PROP_FLOAT, PROP_XYZ); - RNA_def_property_float_sdna(prop, NULL, "maxrot"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_range(prop, -2000.0, 2000.0, 10, 2); - RNA_def_property_ui_text(prop, "Reference Direction", "Reference Direction"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "minloc[0]"); - RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); - RNA_def_property_ui_text(prop, "Min Angle", - "Minimum angle to maintain with target direction " - "(no correction is done if angle with target direction is between min and max)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "maxloc[0]"); - RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); - RNA_def_property_ui_text(prop, "Max Angle", - "Maximum angle allowed with target direction " - "(no correction is done if angle with target direction is between min and max)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_CONST_TYPE_FH */ - prop = RNA_def_property(srna, "fh_height", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get", - "rna_ConstraintActuator_fhheight_set", NULL); - RNA_def_property_ui_range(prop, 0.01, 2000.0, 10, 2); - RNA_def_property_ui_text(prop, "Distance", "Height of the force field area"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_spring_get", "rna_ConstraintActuator_spring_set", NULL); - RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2); - RNA_def_property_ui_text(prop, "Force", "Spring force within the force field area"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "maxrot[0]"); - RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2); - RNA_def_property_ui_text(prop, "Damping", "Damping factor of the force field spring"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* booleans */ - prop = RNA_def_property(srna, "use_force_distance", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DISTANCE); - RNA_def_property_ui_text(prop, "Force Distance", "Force distance of object to point of impact of ray"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_LOCAL); - RNA_def_property_ui_text(prop, "L", "Set ray along object's axis or global axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL); - RNA_def_property_ui_text(prop, "N", - "Set object axis along (local axis) or parallel (global axis) to the normal at " - "hit position"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_PERMANENT); - RNA_def_property_ui_text(prop, "PER", "Persistent actuator: stays active even if ray does not reach target"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /*XXX to use an enum instead of a flag if possible */ - prop = RNA_def_property(srna, "use_material_detect", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_MATERIAL); - RNA_def_property_ui_text(prop, "M/P", "Detect material instead of property"); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Actuator_constraint_detect_material_set"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_fh_paralel_axis", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DOROTFH); - RNA_def_property_ui_text(prop, "Rot Fh", "Keep object axis parallel to normal"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL); - RNA_def_property_ui_text(prop, "N", "Add a horizontal spring force on slopes"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_edit_object_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_dyn_items[] = { - {ACT_EDOB_RESTORE_DYN, "RESTOREDYN", 0, "Restore Dynamics", ""}, - {ACT_EDOB_SUSPEND_DYN, "SUSPENDDYN", 0, "Suspend Dynamics", ""}, - {ACT_EDOB_ENABLE_RB, "ENABLERIGIDBODY", 0, "Enable Rigid Body", ""}, - {ACT_EDOB_DISABLE_RB, "DISABLERIGIDBODY", 0, "Disable Rigid Body", ""}, - {ACT_EDOB_SET_MASS, "SETMASS", 0, "Set Mass", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""}, - {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""}, - {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""}, - {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""}, - {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_track_axis_items[] = { - {ACT_TRACK_TRAXIS_X, "TRACKAXISX", 0, "X axis", ""}, - {ACT_TRACK_TRAXIS_Y, "TRACKAXISY", 0, "Y axis", ""}, - {ACT_TRACK_TRAXIS_Z, "TRACKAXISZ", 0, "Z axis", ""}, - {ACT_TRACK_TRAXIS_NEGX, "TRACKAXISNEGX", 0, "-X axis", ""}, - {ACT_TRACK_TRAXIS_NEGY, "TRACKAXISNEGY", 0, "-Y axis", ""}, - {ACT_TRACK_TRAXIS_NEGZ, "TRACKAXISNEGZ", 0, "-Z axis", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_up_axis_items[] = { - {ACT_TRACK_UP_X, "UPAXISX", 0, "X axis", ""}, - {ACT_TRACK_UP_Y, "UPAXISY", 0, "Y axis", ""}, - {ACT_TRACK_UP_Z, "UPAXISZ", 0, "Z axis", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "EditObjectActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator used to edit objects"); - RNA_def_struct_sdna_from(srna, "bEditObjectActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Edit Object", "The mode of the actuator"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "dynamic_operation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "dyn_operation"); - RNA_def_property_enum_items(prop, prop_dyn_items); - RNA_def_property_ui_text(prop, "Dynamic Operation", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "upflag"); - RNA_def_property_enum_items(prop, prop_up_axis_items); - RNA_def_property_ui_text(prop, "Up Axis", "The axis that points upward"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "trackflag"); - RNA_def_property_enum_items(prop, prop_track_axis_items); - RNA_def_property_ui_text(prop, "Track Axis", "The axis that points to the target object"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_sdna(prop, NULL, "ob"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Object", "Add this Object and all its children (can't be on a visible layer)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "track_object", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_sdna(prop, NULL, "ob"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Object", "Track to this Object"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "mesh", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Mesh"); - RNA_def_property_pointer_sdna(prop, NULL, "me"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Mesh", - "Replace the existing, when left blank 'Phys' will remake the existing physics mesh"); - /* note: custom set function is ONLY to avoid rna setting a user for this. */ - RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_editobject_mesh_set", NULL, NULL); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "time", PROP_INT, PROP_NONE); - RNA_def_property_ui_range(prop, 0, 2000, 1, 1); - RNA_def_property_ui_text(prop, "Time", "Duration the new Object lives or the track takes"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); - RNA_def_property_ui_range(prop, 0, 10000, 1, 2); - RNA_def_property_ui_text(prop, "Mass", "The mass of the object"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* floats 3 Arrays*/ - prop = RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ); - RNA_def_property_float_sdna(prop, NULL, "linVelocity"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_range(prop, -100.0, 100.0, 10, 2); - RNA_def_property_ui_text(prop, "Linear Velocity", "Velocity upon creation"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ); - RNA_def_property_float_sdna(prop, NULL, "angVelocity"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2); - RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity upon creation"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* booleans */ - prop = RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_LINV); - RNA_def_property_ui_text(prop, "L", "Apply the transformation locally"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_ANGV); - RNA_def_property_ui_text(prop, "L", "Apply the rotation locally"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_replace_display_mesh", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_NOGFX); - RNA_def_property_ui_text(prop, "Gfx", "Replace the display mesh"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_replace_physics_mesh", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_PHYS); - RNA_def_property_ui_text(prop, "Phys", - "Replace the physics mesh (triangle bounds only - compound shapes not supported)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_3d_tracking", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TRACK_3D); - RNA_def_property_ui_text(prop, "3D", "Enable 3D tracking"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_scene_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_SCENE_RESTART, "RESTART", 0, "Restart", ""}, - {ACT_SCENE_SET, "SET", 0, "Set Scene", ""}, - {ACT_SCENE_CAMERA, "CAMERA", 0, "Set Camera", ""}, - {ACT_SCENE_ADD_FRONT, "ADDFRONT", 0, "Add Overlay Scene", ""}, - {ACT_SCENE_ADD_BACK, "ADDBACK", 0, "Add Background Scene", ""}, - {ACT_SCENE_REMOVE, "REMOVE", 0, "Remove Scene", ""}, - {ACT_SCENE_SUSPEND, "SUSPEND", 0, "Suspend Scene", ""}, - {ACT_SCENE_RESUME, "RESUME", 0, "Resume Scene", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "SceneActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Scene Actuator", ""); - RNA_def_struct_sdna_from(srna, "bSceneActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Mode", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Camera Object", "Set this Camera (leave empty to refer to self object)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Scene"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Scene", "Scene to be added/removed/paused/resumed"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_random_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_distribution_items[] = { - {ACT_RANDOM_BOOL_CONST, "BOOL_CONSTANT", 0, "Bool Constant", ""}, - {ACT_RANDOM_BOOL_UNIFORM, "BOOL_UNIFORM", 0, "Bool Uniform", ""}, - {ACT_RANDOM_BOOL_BERNOUILLI, "BOOL_BERNOUILLI", 0, "Bool Bernoulli", ""}, - {ACT_RANDOM_INT_CONST, "INT_CONSTANT", 0, "Int Constant", ""}, - {ACT_RANDOM_INT_UNIFORM, "INT_UNIFORM", 0, "Int Uniform", ""}, - {ACT_RANDOM_INT_POISSON, "INT_POISSON", 0, "Int Poisson", ""}, - {ACT_RANDOM_FLOAT_CONST, "FLOAT_CONSTANT", 0, "Float Constant", ""}, - {ACT_RANDOM_FLOAT_UNIFORM, "FLOAT_UNIFORM", 0, "Float Uniform", ""}, - {ACT_RANDOM_FLOAT_NORMAL, "FLOAT_NORMAL", 0, "Float Normal", ""}, - {ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL, "FLOAT_NEGATIVE_EXPONENTIAL", 0, "Float Neg. Exp.", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "RandomActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Random Actuator", ""); - RNA_def_struct_sdna_from(srna, "bRandomActuator", "data"); - - prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); - RNA_def_property_ui_range(prop, 0, 1000, 1, 1); - RNA_def_property_range(prop, 0, MAXFRAME); - RNA_def_property_ui_text(prop, "Seed", - "Initial seed of the random generator, use Python for more freedom " - "(choose 0 for not random)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "propname"); - RNA_def_property_ui_text(prop, "Property", "Assign the random value to this property"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_distribution_items); - RNA_def_property_ui_text(prop, "Distribution", "Choose the type of distribution"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* arguments for the distribution */ - /* int_arg_1, int_arg_2, float_arg_1, float_arg_2 */ - - /* ACT_RANDOM_BOOL_CONST */ - prop = RNA_def_property(srna, "use_always_true", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "int_arg_1", 1); - RNA_def_property_ui_text(prop, "Always True", "Always false or always true"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_RANDOM_BOOL_UNIFORM */ - /* label => "Choose between true and false, 50% chance each" */ - - /* ACT_RANDOM_BOOL_BERNOUILLI */ - prop = RNA_def_property(srna, "chance", PROP_FLOAT, PROP_PERCENTAGE); - RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Chance", "Pick a number between 0 and 1, success if it's below this value"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_RANDOM_INT_CONST */ - prop = RNA_def_property(srna, "int_value", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "int_arg_1"); - RNA_def_property_ui_range(prop, -1000, 1000, 1, 1); - RNA_def_property_ui_text(prop, "Value", "Always return this number"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_RANDOM_INT_UNIFORM */ - prop = RNA_def_property(srna, "int_min", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "int_arg_1"); - RNA_def_property_range(prop, -1000, 1000); - RNA_def_property_ui_text(prop, "Min", "Choose a number from a range: lower boundary of the range"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "int_max", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "int_arg_2"); - RNA_def_property_range(prop, -1000, 1000); - RNA_def_property_ui_text(prop, "Max", "Choose a number from a range: upper boundary of the range"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_RANDOM_INT_POISSON */ - prop = RNA_def_property(srna, "int_mean", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); - RNA_def_property_range(prop, 0.01, 100.0); - RNA_def_property_ui_text(prop, "Mean", "Expected mean value of the distribution"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_RANDOM_FLOAT_CONST */ - prop = RNA_def_property(srna, "float_value", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Value", "Always return this number"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_RANDOM_FLOAT_UNIFORM */ - prop = RNA_def_property(srna, "float_min", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); - RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "Min", "Choose a number from a range: lower boundary of the range"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "float_max", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "float_arg_2"); - RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "Max", "Choose a number from a range: upper boundary of the range"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_RANDOM_FLOAT_NORMAL */ - prop = RNA_def_property(srna, "float_mean", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); - RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "Mean", "A normal distribution: mean of the distribution"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "standard_derivation", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "float_arg_2"); - RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "SD", "A normal distribution: standard deviation of the distribution"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL */ - prop = RNA_def_property(srna, "half_life_time", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); - RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "Half-Life Time", "Negative exponential dropoff"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_message_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_body_type_items[] = { - {ACT_MESG_MESG, "TEXT", 0, "Text", ""}, - {ACT_MESG_PROP, "PROPERTY", 0, "Property", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "MessageActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Message Actuator", ""); - RNA_def_struct_sdna_from(srna, "bMessageActuator", "data"); - - prop = RNA_def_property(srna, "to_property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "toPropName"); - RNA_def_property_ui_text(prop, "To", - "Optional, send message to objects with this name only, or empty to broadcast"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Subject", "Optional, message subject (this is what can be filtered on)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "body_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "bodyType"); - RNA_def_property_enum_items(prop, prop_body_type_items); - RNA_def_property_ui_text(prop, "Body", "Toggle message type: either Text or a PropertyName"); - - /* ACT_MESG_MESG */ - prop = RNA_def_property(srna, "body_message", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "body"); - RNA_def_property_ui_text(prop, "Body", "Optional, message body Text"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_MESG_PROP */ - prop = RNA_def_property(srna, "body_property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "body"); - RNA_def_property_ui_text(prop, "Prop Name", "The message body will be set by the Property Value"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_game_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { -/* {ACT_GAME_LOAD, "LOAD", 0, "Load Game", ""}, */ -/* {ACT_GAME_START, "START", 0, "Start Loaded Game", ""}, */ -/* keeping the load/start hacky for compatibility with 2.49 */ -/* ideally we could use ACT_GAME_START again and do a do_version() */ - - {ACT_GAME_LOAD, "START", 0, "Start Game From File", ""}, - {ACT_GAME_RESTART, "RESTART", 0, "Restart Game", ""}, - {ACT_GAME_QUIT, "QUIT", 0, "Quit Game", ""}, - {ACT_GAME_SAVECFG, "SAVECFG", 0, "Save bge.logic.globalDict", ""}, - {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", ""}, - {ACT_GAME_SCREENSHOT, "SCREENSHOT", 0, "Screenshot", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "GameActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Game Actuator", ""); - RNA_def_struct_sdna_from(srna, "bGameActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Game", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* ACT_GAME_LOAD */ - prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); - RNA_def_property_ui_text(prop, "File", - "The file to use, depending on the mode (e.g. the blend file to load or a destination " - "for saving a screenshot) - use the \"//\" prefix for a relative path"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - /*XXX to do: an operator that calls file_browse with relative_path on and blender filtering active */ -} - -static void rna_def_visibility_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "VisibilityActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Visibility Actuator", "Actuator to set visibility and occlusion of the object"); - RNA_def_struct_sdna_from(srna, "bVisibilityActuator", "data"); - - prop = RNA_def_property(srna, "use_visible", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_VISIBILITY_INVISIBLE); - RNA_def_property_ui_text(prop, "Visible", - "Set the objects visible (initialized from the object render restriction toggle in " - "physics button)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_occlusion", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_OCCLUSION); - RNA_def_property_ui_text(prop, "Occlusion", - "Set the object to occlude objects behind it (initialized from the object type in " - "physics button)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_RECURSIVE); - RNA_def_property_ui_text(prop, "Children", - "Set all the children of this object to the same visibility/occlusion recursively"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_twodfilter_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_2DFILTER_ENABLED, "ENABLE", 0, "Enable Filter", ""}, - {ACT_2DFILTER_DISABLED, "DISABLE", 0, "Disable Filter", ""}, - {ACT_2DFILTER_NOFILTER, "REMOVE", 0, "Remove Filter", ""}, - {ACT_2DFILTER_MOTIONBLUR, "MOTIONBLUR", 0, "Motion Blur", ""}, - {ACT_2DFILTER_BLUR, "BLUR", 0, "Blur", ""}, - {ACT_2DFILTER_SHARPEN, "SHARPEN", 0, "Sharpen", ""}, - {ACT_2DFILTER_DILATION, "DILATION", 0, "Dilation", ""}, - {ACT_2DFILTER_EROSION, "EROSION", 0, "Erosion", ""}, - {ACT_2DFILTER_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", ""}, - {ACT_2DFILTER_SOBEL, "SOBEL", 0, "Sobel", ""}, - {ACT_2DFILTER_PREWITT, "PREWITT", 0, "Prewitt", ""}, - {ACT_2DFILTER_GRAYSCALE, "GRAYSCALE", 0, "Gray Scale", ""}, - {ACT_2DFILTER_SEPIA, "SEPIA", 0, "Sepia", ""}, - {ACT_2DFILTER_INVERT, "INVERT", 0, "Invert", ""}, - {ACT_2DFILTER_CUSTOMFILTER, "CUSTOMFILTER", 0, "Custom Filter", ""}, -/* {ACT_2DFILTER_NUMBER_OF_FILTERS, "", 0, "Do not use it. Sentinel", ""}, */ - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "Filter2DActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Filter 2D Actuator", "Actuator to apply screen graphic effects"); - RNA_def_struct_sdna_from(srna, "bTwoDFilterActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Filter 2D Type", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "glsl_shader", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "text"); - RNA_def_property_struct_type(prop, "Text"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Script", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "filter_pass", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "int_arg"); - RNA_def_property_ui_text(prop, "Pass Number", "Set filter order"); - RNA_def_property_range(prop, 0, 99); /*MAX_RENDER_PASS-1 */ - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "motion_blur_factor", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "float_arg"); - RNA_def_property_ui_text(prop, "Value", "Motion blur factor"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* booleans */ - prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", 1); - RNA_def_property_ui_text(prop, "Enable", "Enable/Disable Motion Blur"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_parent_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_PARENT_SET, "SETPARENT", 0, "Set Parent", ""}, - {ACT_PARENT_REMOVE, "REMOVEPARENT", 0, "Remove Parent", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "ParentActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Parent Actuator", ""); - RNA_def_struct_sdna_from(srna, "bParentActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Scene", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_sdna(prop, NULL, "ob"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Parent Object", "Set this object as parent"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* booleans */ - prop = RNA_def_property(srna, "use_compound", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_PARENT_COMPOUND); - RNA_def_property_ui_text(prop, "Compound", - "Add this object shape to the parent shape " - "(only if the parent shape is already compound)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_PARENT_GHOST); - RNA_def_property_ui_text(prop, "Ghost", "Make this object ghost while parented"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_state_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_STATE_SET, "SET", 0, "Set State", ""}, - {ACT_STATE_ADD, "ADD", 0, "Add State", ""}, - {ACT_STATE_REMOVE, "REMOVE", 0, "Remove State", ""}, - {ACT_STATE_CHANGE, "CHANGE", 0, "Change State", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "StateActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "State Actuator", "Actuator to handle states"); - RNA_def_struct_sdna_from(srna, "bStateActuator", "data"); - - prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Operation", "Select the bit operation on object state mask"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "states", PROP_BOOLEAN, PROP_LAYER_MEMBER); - RNA_def_property_boolean_sdna(prop, NULL, "mask", 1); - RNA_def_property_array(prop, OB_MAX_STATES); - RNA_def_property_ui_text(prop, "State", ""); - RNA_def_property_boolean_funcs(prop, NULL, "rna_StateActuator_state_set"); -} - -static void rna_def_armature_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_ARM_RUN, "RUN", 0, "Run Armature", ""}, - {ACT_ARM_ENABLE, "ENABLE", 0, "Enable", ""}, - {ACT_ARM_DISABLE, "DISABLE", 0, "Disable", ""}, - {ACT_ARM_SETTARGET, "SETTARGET", 0, "Set Target", ""}, - {ACT_ARM_SETWEIGHT, "SETWEIGHT", 0, "Set Weight", ""}, - {ACT_ARM_SETINFLUENCE, "SETINFLUENCE", 0, "Set Influence", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "ArmatureActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Armature Actuator", ""); - RNA_def_struct_sdna_from(srna, "bArmatureActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Constraint Type", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "posechannel"); - RNA_def_property_ui_text(prop, "Bone", "Bone on which the constraint is defined"); - RNA_def_property_update(prop, NC_LOGIC, "rna_Actuator_Armature_update"); - - prop = RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "constraint"); - RNA_def_property_ui_text(prop, "Constraint", "Name of the constraint to control"); - RNA_def_property_update(prop, NC_LOGIC, "rna_Actuator_Armature_update"); - - prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Target", "Set this object as the target of the constraint"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "secondary_target", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "subtarget"); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Secondary Target", - "Set this object as the secondary target of the constraint " - "(only IK polar target at the moment)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "weight"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Weight", "Weight of this constraint"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "influence"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Influence", "Influence of this constraint"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_steering_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_STEERING_SEEK, "SEEK", 0, "Seek", ""}, - {ACT_STEERING_FLEE, "FLEE", 0, "Flee", ""}, - {ACT_STEERING_PATHFOLLOWING, "PATHFOLLOWING", 0, "Path following", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem facingaxis_items[] = { - {1, "X", 0, "X", ""}, - {2, "Y", 0, "Y", ""}, - {3, "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"); - RNA_def_struct_ui_text(srna, "Steering Actuator", ""); - RNA_def_struct_sdna_from(srna, "bSteeringActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Behavior", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "velocity"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Velocity", "Velocity magnitude"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "acceleration", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "acceleration"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Acceleration", "Max acceleration"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "turn_speed", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "turnspeed"); - RNA_def_property_range(prop, 0.0, 720.0); - RNA_def_property_ui_text(prop, "Turn Speed", "Max turn speed"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "dist"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Dist", "Relax distance"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_sdna(prop, NULL, "target"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Target Object", "Target object"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "self_terminated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_SELFTERMINATED); - RNA_def_property_ui_text(prop, "Self Terminated", "Terminate when target is reached"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_visualization", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_ENABLEVISUALIZATION); - RNA_def_property_ui_text(prop, "Visualize", "Enable debug visualization for 'Path following'"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "update_period", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "updateTime"); - RNA_def_property_ui_range(prop, -1, 100000, 1, 1); - RNA_def_property_ui_text(prop, "Update period", "Path update period"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "navmesh", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_pointer_sdna(prop, NULL, "navmesh"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Navigation Mesh Object", "Navigation mesh"); - RNA_def_property_pointer_funcs(prop, NULL, "rna_SteeringActuator_navmesh_set", NULL, NULL); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "facing", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_AUTOMATICFACING); - RNA_def_property_ui_text(prop, "Facing", "Enable automatic facing"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "facing_axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "facingaxis"); - RNA_def_property_enum_items(prop, facingaxis_items); - RNA_def_property_ui_text(prop, "Axis", "Axis for automatic facing"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "normal_up", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_NORMALUP); - RNA_def_property_ui_text(prop, "N", "Use normal of the navmesh to set \"UP\" vector"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "lock_z_velocity", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_LOCKZVEL); - RNA_def_property_ui_text(prop, "Lock Z velocity", "Disable simulation of linear motion along Z axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_mouse_actuator(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_type_items[] = { - {ACT_MOUSE_VISIBILITY, "VISIBILITY", 0, "Visibility", ""}, - {ACT_MOUSE_LOOK, "LOOK", 0, "Look", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_object_axis_items[] = { - {ACT_MOUSE_OBJECT_AXIS_X, "OBJECT_AXIS_X", 0, "X Axis", ""}, - {ACT_MOUSE_OBJECT_AXIS_Y, "OBJECT_AXIS_Y", 0, "Y Axis", ""}, - {ACT_MOUSE_OBJECT_AXIS_Z, "OBJECT_AXIS_Z", 0, "Z Axis", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "MouseActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "Mouse Actuator", ""); - RNA_def_struct_sdna_from(srna, "bMouseActuator", "data"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Mode", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Visibility */ - prop = RNA_def_property(srna, "visible", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_MOUSE_VISIBLE); - RNA_def_property_ui_text(prop, "Visible", "Make mouse cursor visible"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Mouse Look */ - prop = RNA_def_property(srna, "use_axis_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_MOUSE_USE_AXIS_X); - RNA_def_property_ui_text(prop, "Use X Axis", "Calculate mouse movement on the X axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_axis_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_MOUSE_USE_AXIS_Y); - RNA_def_property_ui_text(prop, "Use Y Axis", "Calculate mouse movement on the Y axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "reset_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_MOUSE_RESET_X); - RNA_def_property_ui_text(prop, "Reset", - "Reset the cursor's X position to the center of the screen space after calculating"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "reset_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_MOUSE_RESET_Y); - RNA_def_property_ui_text(prop, "Reset", - "Reset the cursor's Y position to the center of the screen space after calculating"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "local_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_MOUSE_LOCAL_X); - RNA_def_property_ui_text(prop, "Local", "Apply rotation locally"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "local_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_MOUSE_LOCAL_Y); - RNA_def_property_ui_text(prop, "Local", "Apply rotation locally"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "threshold_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "threshold[0]"); - RNA_def_property_ui_range(prop, 0, 0.5, 1, 3); - RNA_def_property_ui_text(prop, "Threshold", "Amount of X motion before mouse movement will register"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "threshold_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "threshold[1]"); - RNA_def_property_ui_range(prop, 0, 0.5, 1, 3); - RNA_def_property_ui_text(prop, "Threshold", "Amount of Y motion before mouse movement will register"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "object_axis_x", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "object_axis[0]"); - RNA_def_property_enum_items(prop, prop_object_axis_items); - RNA_def_property_ui_text(prop, "Object Axis", "Local object axis mouse movement in the X direction will apply to"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "object_axis_y", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "object_axis[1]"); - RNA_def_property_enum_items(prop, prop_object_axis_items); - RNA_def_property_ui_text(prop, "Object Axis", "Local object axis mouse movement in the Y direction will apply to"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "sensitivity_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sensitivity[0]"); - RNA_def_property_ui_range(prop, -100.0, 100.0, 0.2, 3); - RNA_def_property_ui_text(prop, "Sensitivity", "Sensitivity of the X axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "sensitivity_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sensitivity[1]"); - RNA_def_property_ui_range(prop, -100.0, 100.0, 0.2, 3); - RNA_def_property_ui_text(prop, "Sensitivity", "Sensitivity of the Y axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "limit_x[0]"); - RNA_def_property_ui_range(prop, DEG2RADF(-3600.0f), 0.0, 9, 3); - RNA_def_property_ui_text(prop, "Min", "Maximum negative rotation allowed by X mouse movement (0 for infinite)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "limit_x[1]"); - RNA_def_property_ui_range(prop, 0.0, DEG2RADF(3600.0f), 9, 3); - RNA_def_property_ui_text(prop, "Max", "Maximum positive rotation allowed by X mouse movement (0 for infinite)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "limit_y[0]"); - RNA_def_property_ui_range(prop, DEG2RADF(-3600.0f), 0.0, 9, 3); - RNA_def_property_ui_text(prop, "Min", "Maximum negative rotation allowed by Y mouse movement (0 for infinite)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "limit_y[1]"); - RNA_def_property_ui_range(prop, 0.0, DEG2RADF(3600.0f), 9, 3); - RNA_def_property_ui_text(prop, "Max", "Maximum positive rotation allowed by Y mouse movement (0 for infinite)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -void RNA_def_actuator(BlenderRNA *brna) -{ - rna_def_actuator(brna); - - rna_def_action_actuator(brna); - rna_def_object_actuator(brna); - rna_def_camera_actuator(brna); - rna_def_sound_actuator(brna); - rna_def_property_actuator(brna); - rna_def_constraint_actuator(brna); - rna_def_edit_object_actuator(brna); - rna_def_scene_actuator(brna); - rna_def_random_actuator(brna); - rna_def_message_actuator(brna); - rna_def_game_actuator(brna); - rna_def_visibility_actuator(brna); - rna_def_twodfilter_actuator(brna); - rna_def_parent_actuator(brna); - rna_def_state_actuator(brna); - rna_def_armature_actuator(brna); - rna_def_steering_actuator(brna); - rna_def_mouse_actuator(brna); -} - -#endif diff --git a/source/blender/makesrna/intern/rna_actuator_api.c b/source/blender/makesrna/intern/rna_actuator_api.c deleted file mode 100644 index 23fdd8a1d5b..00000000000 --- a/source/blender/makesrna/intern/rna_actuator_api.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2010 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/makesrna/intern/rna_actuator_api.c - * \ingroup RNA - */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "WM_types.h" -#include "RNA_define.h" - -#include "rna_internal.h" /* own include */ - -#ifdef RNA_RUNTIME - -#include "BKE_sca.h" -#include "DNA_controller_types.h" -#include "DNA_actuator_types.h" - -static void rna_Actuator_link(bActuator *act, bController *cont) -{ - link_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks, sizeof(bActuator *)); -} - -static void rna_Actuator_unlink(bActuator *act, bController *cont) -{ - unlink_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks); -} - -#else - -void RNA_api_actuator(StructRNA *srna) -{ - FunctionRNA *func; - PropertyRNA *parm; - - func = RNA_def_function(srna, "link", "rna_Actuator_link"); - RNA_def_function_ui_description(func, "Link the actuator to a controller"); - parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - RNA_def_property_update(parm, NC_LOGIC, NULL); - - func = RNA_def_function(srna, "unlink", "rna_Actuator_unlink"); - RNA_def_function_ui_description(func, "Unlink the actuator from a controller"); - parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - RNA_def_property_update(parm, NC_LOGIC, NULL); -} - -#endif - diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 05074bc9f16..3afa682e75f 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -989,11 +989,6 @@ static void rna_def_armature(BlenderRNA *brna) {ARM_WIRE, "WIRE", 0, "Wire", "Display bones as thin wires, showing subdivision and B-Splines"}, {0, NULL, 0, NULL, NULL} }; - static const EnumPropertyItem prop_vdeformer[] = { - {ARM_VDEF_BLENDER, "BLENDER", 0, "Blender", "Use Blender's armature vertex deformation"}, - {ARM_VDEF_BGE_CPU, "BGE_CPU", 0, "BGE", "Use vertex deformation code optimized for the BGE"}, - {0, NULL, 0, NULL, NULL} - }; static const EnumPropertyItem prop_ghost_type_items[] = { {ARM_GHOST_CUR, "CURRENT_FRAME", 0, "Around Frame", "Display Ghosts of poses within a fixed number of frames around the current frame"}, @@ -1050,13 +1045,6 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "gevertdeformer"); - RNA_def_property_enum_items(prop, prop_vdeformer); - RNA_def_property_ui_text(prop, "Vertex Deformer", "Vertex Deformer Method (Game Engine only)"); - RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); - RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); - /* XXX deprecated ....... old animviz for armatures only */ prop = RNA_def_property(srna, "ghost_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ghosttype"); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 8eb6bc1261e..97114e02e48 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -100,8 +100,8 @@ const EnumPropertyItem rna_enum_constraint_type_items[] = { "Use to animate an object/bone following a path"}, {CONSTRAINT_TYPE_PIVOT, "PIVOT", ICON_CONSTRAINT_DATA, "Pivot", "Change pivot point for transforms (buggy)"}, - {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", - "Use to define a Rigid Body Constraint (for Game Engine use only)"}, + /* {CONSTRAINT_TYPE_RIGIDBODYJOINT, "RIGID_BODY_JOINT", ICON_CONSTRAINT_DATA, "Rigid Body Joint", + "Use to define a Rigid Body Constraint (for Game Engine use only)"}, */ /* {CONSTRAINT_TYPE_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script", "Custom constraint(s) written in Python (Not yet implemented)"}, */ {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT_DATA, "Shrinkwrap", @@ -190,8 +190,6 @@ static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) return &RNA_StretchToConstraint; case CONSTRAINT_TYPE_MINMAX: return &RNA_FloorConstraint; - case CONSTRAINT_TYPE_RIGIDBODYJOINT: - return &RNA_RigidBodyJointConstraint; case CONSTRAINT_TYPE_CLAMPTO: return &RNA_ClampToConstraint; case CONSTRAINT_TYPE_TRANSFORM: @@ -1419,178 +1417,6 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); } -static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem pivot_items[] = { - {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allow rotations around all axes"}, - {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Work in one plane, allow rotations around one axis only"}, - {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", - "Allow rotations around all axes with limits for the cone and twist axes"}, - {CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", - "No constraints by default, limits can be set individually"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "RigidBodyJointConstraint", "Constraint"); - RNA_def_struct_ui_text(srna, "Rigid Body Joint Constraint", "For use with the Game Engine"); - RNA_def_struct_sdna_from(srna, "bRigidBodyJointConstraint", "data"); - - prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "tar"); - 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, "child", PROP_POINTER, PROP_NONE); - RNA_def_property_ui_text(prop, "Child Object", "Child 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, "pivot_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, pivot_items); - RNA_def_property_ui_text(prop, "Pivot Type", ""); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "pivX"); - RNA_def_property_range(prop, -1000.0, 1000.f); - RNA_def_property_ui_text(prop, "Pivot X", "Offset pivot on X"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "pivY"); - RNA_def_property_range(prop, -1000.0, 1000.f); - RNA_def_property_ui_text(prop, "Pivot Y", "Offset pivot on Y"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "pivZ"); - RNA_def_property_range(prop, -1000.0, 1000.f); - RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "axX"); - RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "axY"); - RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "axZ"); - RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE_LINKED_COLLISION); - RNA_def_property_ui_text(prop, "Disable Linked Collision", "Disable collision between linked bodies"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "show_pivot", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DRAW_PIVOT); - RNA_def_property_ui_text(prop, "Draw Pivot", "Display the pivot point and rotation in 3D view"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - - /* Limits */ - /* Limit Min/Max */ - prop = RNA_def_property(srna, "limit_min_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "minLimit[0]"); - RNA_def_property_ui_text(prop, "Minimum Limit X", ""); - - prop = RNA_def_property(srna, "limit_min_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "minLimit[1]"); - RNA_def_property_ui_text(prop, "Minimum Limit Y", ""); - - prop = RNA_def_property(srna, "limit_min_z", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "minLimit[2]"); - RNA_def_property_ui_text(prop, "Minimum Limit Z", ""); - - prop = RNA_def_property(srna, "limit_max_x", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "maxLimit[0]"); - RNA_def_property_ui_text(prop, "Maximum Limit X", ""); - - prop = RNA_def_property(srna, "limit_max_y", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "maxLimit[1]"); - RNA_def_property_ui_text(prop, "Maximum Limit Y", ""); - - prop = RNA_def_property(srna, "limit_max_z", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "maxLimit[2]"); - RNA_def_property_ui_text(prop, "Maximum Limit Z", ""); - - /* Limit Min/Max for angle */ - prop = RNA_def_property(srna, "limit_angle_min_x", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "minLimit[3]"); - RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Minimum Angular Limit X", ""); - - prop = RNA_def_property(srna, "limit_angle_min_y", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "minLimit[4]"); - RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Minimum Angular Limit Y", ""); - - prop = RNA_def_property(srna, "limit_angle_min_z", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "minLimit[5]"); - RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Minimum Angular Limit Z", ""); - - prop = RNA_def_property(srna, "limit_angle_max_x", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "maxLimit[3]"); - RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Maximum Angular Limit X", ""); - - prop = RNA_def_property(srna, "limit_angle_max_y", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "maxLimit[4]"); - RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Maximum Angular Limit Y", ""); - - prop = RNA_def_property(srna, "limit_angle_max_z", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "maxLimit[5]"); - RNA_def_property_range(prop, -M_PI * 2, M_PI * 2); - RNA_def_property_ui_text(prop, "Maximum Angular Limit Z", ""); - - /* Limit Booleans */ - prop = RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", 1); - RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum X limit"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", 2); - RNA_def_property_ui_text(prop, "Limit Y", "Use minimum/maximum y limit"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", 4); - RNA_def_property_ui_text(prop, "Limit Z", "Use minimum/maximum z limit"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", 8); - RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum X angular limit"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", 16); - RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum Y angular limit"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - - prop = RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", 32); - RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum Z angular limit"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); -} - static void rna_def_constraint_clamp_to(BlenderRNA *brna) { StructRNA *srna; @@ -2718,7 +2544,6 @@ void RNA_def_constraint(BlenderRNA *brna) rna_def_constraint_minmax(brna); rna_def_constraint_track_to(brna); rna_def_constraint_kinematic(brna); - rna_def_constraint_rigid_body_joint(brna); rna_def_constraint_clamp_to(brna); rna_def_constraint_distance_limit(brna); rna_def_constraint_size_limit(brna); diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c deleted file mode 100644 index bdb3daedebb..00000000000 --- a/source/blender/makesrna/intern/rna_controller.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * ***** 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_controller.c - * \ingroup RNA - */ - -#include <stdlib.h> - -#include "DNA_object_types.h" -#include "DNA_controller_types.h" - -#include "BLI_string_utils.h" -#include "BLI_utildefines.h" - -#include "BLT_translation.h" - -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - -#include "WM_types.h" - -const EnumPropertyItem rna_enum_controller_type_items[] = { - {CONT_LOGIC_AND, "LOGIC_AND", 0, "And", "Logic And"}, - {CONT_LOGIC_OR, "LOGIC_OR", 0, "Or", "Logic Or"}, - {CONT_LOGIC_NAND, "LOGIC_NAND", 0, "Nand", "Logic Nand"}, - {CONT_LOGIC_NOR, "LOGIC_NOR", 0, "Nor", "Logic Nor"}, - {CONT_LOGIC_XOR, "LOGIC_XOR", 0, "Xor", "Logic Xor"}, - {CONT_LOGIC_XNOR, "LOGIC_XNOR", 0, "Xnor", "Logic Xnor"}, - {CONT_EXPRESSION, "EXPRESSION", 0, "Expression", ""}, - {CONT_PYTHON, "PYTHON", 0, "Python", ""}, - {0, NULL, 0, NULL, NULL} -}; - -#ifdef RNA_RUNTIME - -#include "BKE_sca.h" -#include "DNA_actuator_types.h" - -static StructRNA *rna_Controller_refine(struct PointerRNA *ptr) -{ - bController *controller = (bController *)ptr->data; - - switch (controller->type) { - case CONT_LOGIC_AND: - return &RNA_AndController; - case CONT_LOGIC_OR: - return &RNA_OrController; - case CONT_LOGIC_NAND: - return &RNA_NandController; - case CONT_LOGIC_NOR: - return &RNA_NorController; - case CONT_LOGIC_XOR: - return &RNA_XorController; - case CONT_LOGIC_XNOR: - return &RNA_XnorController; - case CONT_EXPRESSION: - return &RNA_ExpressionController; - case CONT_PYTHON: - return &RNA_PythonController; - default: - return &RNA_Controller; - } -} - -static void rna_Constroller_name_set(PointerRNA *ptr, const char *value) -{ - Object *ob = ptr->id.data; - bController *cont = ptr->data; - BLI_strncpy_utf8(cont->name, value, sizeof(cont->name)); - BLI_uniquename(&ob->controllers, cont, DATA_("Controller"), '.', offsetof(bController, name), sizeof(cont->name)); -} - -static void rna_Controller_type_set(struct PointerRNA *ptr, int value) -{ - bController *cont = (bController *)ptr->data; - - if (value != cont->type) { - cont->type = value; - init_controller(cont); - } -} - -static void rna_Controller_mode_set(struct PointerRNA *ptr, int value) -{ - bController *cont = (bController *)ptr->data; - bPythonCont *pycon = (bPythonCont *)cont->data; - - /* if mode changed and previous mode were Script */ - if (value != pycon->mode && pycon->mode == CONT_PY_SCRIPT) { - /* clear script to avoid it to get linked with the controller */ - pycon->text = NULL; - } - pycon->mode = value; -} - -static int rna_Controller_state_number_get(struct PointerRNA *ptr) -{ - bController *cont = (bController *)ptr->data; - int bit; - - for (bit = 0; bit < 32; bit++) { - if (cont->state_mask & (1u << bit)) - return bit + 1; - } - return 0; -} - -static void rna_Controller_state_number_set(struct PointerRNA *ptr, const int value) -{ - bController *cont = (bController *)ptr->data; - if (value < 1 || value > OB_MAX_STATES) - return; - - cont->state_mask = (1 << (value - 1)); -} - -static void rna_Controller_actuators_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) -{ - bController *cont = (bController *)ptr->data; - rna_iterator_array_begin(iter, cont->links, sizeof(bActuator *), (int)cont->totlinks, 0, NULL); -} - -static int rna_Controller_actuators_length(PointerRNA *ptr) -{ - bController *cont = (bController *)ptr->data; - return (int) cont->totlinks; -} - -#if 0 /* editable is set to false, comment for now. */ -static void rna_Controller_state_get(PointerRNA *ptr, int *values) -{ - bController *cont = (bController *)ptr->data; - int i; - - memset(values, 0, sizeof(int) * OB_MAX_STATES); - for (i = 0; i < OB_MAX_STATES; i++) - values[i] = (cont->state_mask & (1 << i)); -} - -static void rna_Controller_state_set(PointerRNA *ptr, const int *values) -{ - bController *cont = (bController *)ptr->data; - int i, tot = 0; - - /* ensure we always have some state selected */ - for (i = 0; i < OB_MAX_STATES; i++) - if (values[i]) - tot++; - - if (tot == 0) - return; - - /* only works for one state at once */ - if (tot > 1) - return; - - for (i = 0; i < OB_MAX_STATES; i++) { - if (values[i]) cont->state_mask |= (1 << i); - else cont->state_mask &= ~(1 << i); - } -} -#endif - -#else - -void RNA_def_controller(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem python_controller_modes[] = { - {CONT_PY_SCRIPT, "SCRIPT", 0, "Script", ""}, - {CONT_PY_MODULE, "MODULE", 0, "Module", ""}, - {0, NULL, 0, NULL, NULL} - }; - - /* Controller */ - srna = RNA_def_struct(brna, "Controller", NULL); - RNA_def_struct_sdna(srna, "bController"); - RNA_def_struct_refine_func(srna, "rna_Controller_refine"); - RNA_def_struct_ui_text(srna, "Controller", - "Game engine logic brick to process events, connecting sensors to actuators"); - - RNA_api_controller(srna); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Name", ""); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constroller_name_set"); - RNA_def_struct_name_property(srna, prop); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_enum_funcs(prop, NULL, "rna_Controller_type_set", NULL); - RNA_def_property_enum_items(prop, rna_enum_controller_type_items); - RNA_def_property_ui_text(prop, "Type", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_SHOW); - RNA_def_property_ui_text(prop, "Expanded", "Set controller expanded in the user interface"); - RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONT_DEACTIVATE); - RNA_def_property_ui_text(prop, "Active", "Set the active state of the controller"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_priority", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PRIO); - RNA_def_property_ui_text(prop, "Priority", - "Mark controller for execution before all non-marked controllers " - "(good for startup scripts)"); - RNA_def_property_ui_icon(prop, ICON_BOOKMARKS, 1); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "links", NULL); - RNA_def_property_struct_type(prop, "Actuator"); - RNA_def_property_ui_text(prop, "Actuators", "The list containing the actuators connected to the controller"); - RNA_def_property_collection_funcs(prop, "rna_Controller_actuators_begin", "rna_iterator_array_next", - "rna_iterator_array_end", "rna_iterator_array_dereference_get", - "rna_Controller_actuators_length", NULL, NULL, NULL); - - /* State */ - - /* array of OB_MAX_STATES */ - /*prop = RNA_def_property(srna, "states", PROP_BOOLEAN, PROP_LAYER_MEMBER); */ - /*RNA_def_property_array(prop, OB_MAX_STATES); */ - /*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ - /*RNA_def_property_ui_text(prop, "", "Set Controller state index (1 to 30)"); */ - /*RNA_def_property_boolean_funcs(prop, "rna_Controller_state_get", "rna_Controller_state_set"); */ - /*RNA_def_property_update(prop, NC_LOGIC, NULL); */ - - /* number of the state */ - prop = RNA_def_property(srna, "states", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_sdna(prop, NULL, "state_mask"); - RNA_def_property_range(prop, 1, OB_MAX_STATES); - RNA_def_property_ui_text(prop, "", "Set Controller state index (1 to 30)"); - RNA_def_property_int_funcs(prop, "rna_Controller_state_number_get", "rna_Controller_state_number_set", NULL); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Expression Controller */ - srna = RNA_def_struct(brna, "ExpressionController", "Controller"); - RNA_def_struct_sdna_from(srna, "bExpressionCont", "data"); - RNA_def_struct_ui_text(srna, "Expression Controller", - "Controller passing on events based on the evaluation of an expression"); - - prop = RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "str"); - RNA_def_property_ui_text(prop, "Expression", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Python Controller */ - srna = RNA_def_struct(brna, "PythonController", "Controller"); - RNA_def_struct_sdna_from(srna, "bPythonCont", "data"); - RNA_def_struct_ui_text(srna, "Python Controller", "Controller executing a python script"); - - prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, python_controller_modes); - RNA_def_property_enum_funcs(prop, NULL, "rna_Controller_mode_set", NULL); - RNA_def_property_ui_text(prop, "Execution Method", "Python script type (textblock or module - faster)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Text"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Text", "Text data-block with the python script"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "module", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Module", - "Module name and function to run, e.g. \"someModule.main\" " - "(internal texts and external python files can be used)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_debug", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PY_DEBUG); - RNA_def_property_ui_text(prop, "D", - "Continuously reload the module from disk for editing external modules " - "without restarting"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Other Controllers */ - srna = RNA_def_struct(brna, "AndController", "Controller"); - RNA_def_struct_ui_text(srna, "And Controller", "Controller passing on events based on a logical AND operation"); - - srna = RNA_def_struct(brna, "OrController", "Controller"); - RNA_def_struct_ui_text(srna, "Or Controller", "Controller passing on events based on a logical OR operation"); - - srna = RNA_def_struct(brna, "NorController", "Controller"); - RNA_def_struct_ui_text(srna, "Nor Controller", "Controller passing on events based on a logical NOR operation"); - - srna = RNA_def_struct(brna, "NandController", "Controller"); - RNA_def_struct_ui_text(srna, "Nand Controller", "Controller passing on events based on a logical NAND operation"); - - srna = RNA_def_struct(brna, "XorController", "Controller"); - RNA_def_struct_ui_text(srna, "Xor Controller", "Controller passing on events based on a logical XOR operation"); - - srna = RNA_def_struct(brna, "XnorController", "Controller"); - RNA_def_struct_ui_text(srna, "Xnor Controller", "Controller passing on events based on a logical XNOR operation"); -} - -#endif diff --git a/source/blender/makesrna/intern/rna_controller_api.c b/source/blender/makesrna/intern/rna_controller_api.c deleted file mode 100644 index 639d6a330a5..00000000000 --- a/source/blender/makesrna/intern/rna_controller_api.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2010 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/makesrna/intern/rna_controller_api.c - * \ingroup RNA - */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "WM_types.h" -#include "RNA_define.h" - -#include "rna_internal.h" /* own include */ - -#ifdef RNA_RUNTIME - -#include "BKE_sca.h" -#include "DNA_sensor_types.h" -#include "DNA_controller_types.h" -#include "DNA_actuator_types.h" - -static void rna_Controller_link(bController *cont, bSensor *sens, bActuator *act) -{ - if (sens) - link_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks, sizeof(bController *)); - if (act) - link_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks, sizeof(bActuator *)); -} - -static void rna_Controller_unlink(bController *cont, bSensor *sens, bActuator *act) -{ - if (sens) - unlink_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks); - if (act) - unlink_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks); -} - -#else - -void RNA_api_controller(StructRNA *srna) -{ - FunctionRNA *func; - PropertyRNA *parm; - - func = RNA_def_function(srna, "link", "rna_Controller_link"); - RNA_def_function_ui_description(func, "Link the controller with a sensor/actuator"); - parm = RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to link the controller to"); - RNA_def_property_update(parm, NC_LOGIC, NULL); - parm = RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to link the controller to"); - RNA_def_property_update(parm, NC_LOGIC, NULL); - - func = RNA_def_function(srna, "unlink", "rna_Controller_unlink"); - RNA_def_function_ui_description(func, "Unlink the controller from a sensor/actuator"); - parm = RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to unlink the controller from"); - RNA_def_property_update(parm, NC_LOGIC, NULL); - parm = RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to unlink the controller from"); - RNA_def_property_update(parm, NC_LOGIC, NULL); -} - -#endif - diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index c1f82bab300..11ad39a2dd1 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -151,7 +151,6 @@ void RNA_def_depsgraph(struct BlenderRNA *brna); void RNA_def_dynamic_paint(struct BlenderRNA *brna); void RNA_def_fluidsim(struct BlenderRNA *brna); void RNA_def_fcurve(struct BlenderRNA *brna); -void RNA_def_gameproperty(struct BlenderRNA *brna); void RNA_def_gpencil(struct BlenderRNA *brna); void RNA_def_group(struct BlenderRNA *brna); void RNA_def_image(struct BlenderRNA *brna); diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 36e6afe26d6..e6fa7bb26dd 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -1000,18 +1000,6 @@ static int rna_ViewRenderSettings_use_spherical_stereo_get(PointerRNA *ptr) return BKE_viewrender_use_spherical_stereo(view_render); } -static int rna_ViewRenderSettings_use_game_engine_get(PointerRNA *ptr) -{ - ViewRender *view_render = (ViewRender *)ptr->data; - RenderEngineType *type; - - for (type = R_engines.first; type; type = type->next) - if (STREQ(type->idname, view_render->engine_id)) - return (type->flag & RE_GAME) != 0; - - return 0; -} - #else static void rna_def_scene_collections(BlenderRNA *brna, PropertyRNA *cprop) @@ -2233,11 +2221,6 @@ static void rna_def_scene_view_render(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_spherical_stereo_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Use Spherical Stereo", "Active render engine supports spherical stereo rendering"); - - prop = RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_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_view_layer(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 8bc818d2658..d800022ec82 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -153,11 +153,6 @@ static PointerRNA rna_Material_strand_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_MaterialStrand, ptr->id.data); } -static PointerRNA rna_Material_physics_get(PointerRNA *ptr) -{ - return rna_pointer_inherit_refine(ptr, &RNA_MaterialPhysics, ptr->id.data); -} - static void rna_Material_type_set(PointerRNA *ptr, int value) { Material *ma = (Material *)ptr->data; @@ -843,67 +838,6 @@ static void rna_def_material_mtex(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Material_update"); } -static void rna_def_material_gamesettings(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem prop_alpha_blend_items[] = { - {GEMAT_SOLID, "OPAQUE", 0, "Opaque", "Render color of textured face as color"}, - {GEMAT_ADD, "ADD", 0, "Add", "Render face transparent and add color of face"}, - {GEMAT_CLIP, "CLIP", 0, "Alpha Clip", "Use the image alpha values clipped with no blending (binary alpha)"}, - {GEMAT_ALPHA, "ALPHA", 0, "Alpha Blend", - "Render polygon transparent, depending on alpha channel of the texture"}, - {GEMAT_ALPHA_SORT, "ALPHA_SORT", 0, "Alpha Sort", - "Sort faces for correct alpha drawing (slow, use Alpha Clip instead when possible)"}, - {GEMAT_ALPHA_TO_COVERAGE, "ALPHA_ANTIALIASING", 0, "Alpha Anti-Aliasing", - "Use textures alpha as anti-aliasing mask, requires multi-sample OpenGL display"}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_face_orientation_items[] = { - {GEMAT_NORMAL, "NORMAL", 0, "Normal", "No transformation"}, - {GEMAT_HALO, "HALO", 0, "Halo", "Screen aligned billboard"}, - {GEMAT_BILLBOARD, "BILLBOARD", 0, "Billboard", "Billboard with Z-axis constraint"}, - {GEMAT_SHADOW, "SHADOW", 0, "Shadow", "Faces are used for shadow"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "MaterialGameSettings", NULL); - RNA_def_struct_sdna(srna, "GameSettings"); - RNA_def_struct_nested(brna, srna, "Material"); - RNA_def_struct_ui_text(srna, "Material Game Settings", "Game Engine settings for a Material data-block"); - - prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_BACKCULL); /* use bitflags */ - RNA_def_property_ui_text(prop, "Backface Culling", "Hide Back of the face in Game Engine "); - RNA_def_property_update(prop, 0, "rna_Material_draw_update"); - - prop = RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_TEXT); /* use bitflags */ - RNA_def_property_ui_text(prop, "Text", "Use material as text in Game Engine "); - RNA_def_property_update(prop, 0, "rna_Material_draw_update"); - - prop = RNA_def_property(srna, "invisible", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_INVISIBLE); /* use bitflags */ - RNA_def_property_ui_text(prop, "Invisible", "Make face invisible"); - RNA_def_property_update(prop, 0, "rna_Material_draw_update"); - - prop = RNA_def_property(srna, "alpha_blend", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "alpha_blend"); - RNA_def_property_enum_items(prop, prop_alpha_blend_items); - RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces"); - RNA_def_property_update(prop, 0, "rna_Material_draw_update"); - - prop = RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_face_orientation_items); - RNA_def_property_ui_text(prop, "Face Orientations", "Especial face orientation options"); - - prop = RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GEMAT_NOPHYSICS); /* use bitflags */ - RNA_def_property_ui_text(prop, "Physics", "Use physics properties of materials "); -} - static void rna_def_material_colors(StructRNA *srna) { PropertyRNA *prop; @@ -1741,50 +1675,6 @@ static void rna_def_material_strand(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Material_update"); } -static void rna_def_material_physics(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "MaterialPhysics", NULL); - RNA_def_struct_sdna(srna, "Material"); - RNA_def_struct_nested(brna, srna, "Material"); - RNA_def_struct_ui_text(srna, "Material Physics", "Physics settings for a Material data-block"); - - prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "friction"); - RNA_def_property_range(prop, 0, 100); - RNA_def_property_ui_text(prop, "Friction", "Coulomb friction coefficient, when inside the physics distance area"); - - prop = RNA_def_property(srna, "elasticity", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "reflect"); - RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Elasticity", "Elasticity of collisions"); - - /* FH/Force Field Settings */ - prop = RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "dynamode", MA_FH_NOR); - RNA_def_property_ui_text(prop, "Align to Normal", - "Align dynamic game objects along the surface normal, " - "when inside the physics distance area"); - - prop = RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "fh"); - RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2); - RNA_def_property_ui_text(prop, "Force", "Upward spring force, when inside the physics distance area"); - - prop = RNA_def_property(srna, "fh_distance", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "fhdist"); - RNA_def_property_range(prop, 0, 20); - RNA_def_property_ui_text(prop, "Distance", "Distance of the physics area"); - - prop = RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "xyfrict"); - RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Damping", "Damping of the spring force, when inside the physics distance area"); -} - void RNA_def_material(BlenderRNA *brna) { StructRNA *srna; @@ -2149,19 +2039,6 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_struct_type(prop, "MaterialStrand"); RNA_def_property_pointer_funcs(prop, "rna_Material_strand_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Strand", "Strand settings for the material"); - - prop = RNA_def_property(srna, "physics", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_struct_type(prop, "MaterialPhysics"); - RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Physics", "Game physics settings"); - - /* game settings */ - prop = RNA_def_property(srna, "game_settings", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "game"); - RNA_def_property_struct_type(prop, "MaterialGameSettings"); - RNA_def_property_ui_text(prop, "Game Settings", "Game material settings"); /* nodetree */ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); @@ -2210,8 +2087,6 @@ void RNA_def_material(BlenderRNA *brna) rna_def_material_sss(brna); rna_def_material_mtex(brna); rna_def_material_strand(brna); - rna_def_material_physics(brna); - rna_def_material_gamesettings(brna); RNA_api_material(srna); } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 1932390d0fd..9a3066207f9 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -29,13 +29,11 @@ #include "DNA_action_types.h" #include "DNA_customdata_types.h" -#include "DNA_controller_types.h" #include "DNA_group_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" #include "DNA_object_force_types.h" #include "DNA_object_types.h" -#include "DNA_property_types.h" #include "DNA_scene_types.h" #include "DNA_meta_types.h" #include "DNA_workspace_types.h" @@ -121,18 +119,6 @@ static EnumPropertyItem dupli_items_nogroup[] = { #undef DUPLI_ITEMS_SHARED #undef DUPLI_ITEM_GROUP -static const EnumPropertyItem collision_bounds_items[] = { - {OB_BOUND_BOX, "BOX", ICON_MESH_CUBE, "Box", ""}, - {OB_BOUND_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""}, - {OB_BOUND_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""}, - {OB_BOUND_CONE, "CONE", ICON_MESH_CONE, "Cone", ""}, - {OB_BOUND_CONVEX_HULL, "CONVEX_HULL", ICON_MESH_ICOSPHERE, "Convex Hull", ""}, - {OB_BOUND_TRIANGLE_MESH, "TRIANGLE_MESH", ICON_MESH_MONKEY, "Triangle Mesh", ""}, - {OB_BOUND_CAPSULE, "CAPSULE", ICON_MESH_CAPSULE, "Capsule", ""}, - /*{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""}, */ - {0, NULL, 0, NULL, NULL} -}; - const EnumPropertyItem rna_enum_metaelem_type_items[] = { {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""}, {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""}, @@ -192,7 +178,6 @@ const EnumPropertyItem rna_enum_object_axis_items[] = { #include "DNA_node_types.h" #include "BKE_armature.h" -#include "BKE_bullet.h" #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_curve.h" @@ -469,32 +454,6 @@ static void rna_Object_empty_draw_type_set(PointerRNA *ptr, int value) BKE_object_empty_draw_type_set(ob, value); } -static const EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) -{ - Object *ob = (Object *)ptr->data; - EnumPropertyItem *item = NULL; - int totitem = 0; - - if (ob->body_type != OB_BODY_TYPE_CHARACTER) { - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_TRIANGLE_MESH); - } - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONVEX_HULL); - - if (ob->body_type != OB_BODY_TYPE_SOFT) { - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONE); - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CYLINDER); - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_SPHERE); - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_BOX); - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CAPSULE); - } - - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; -} - static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value) { Object *ob = (Object *)ptr->data; @@ -1047,122 +1006,6 @@ static char *rna_MaterialSlot_path(PointerRNA *ptr) * * logic from check_body_type() * */ -static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->id.data; - - /* determine the body_type setting based on flags */ - if (!(ob->gameflag & OB_COLLISION)) { - if (ob->gameflag & OB_OCCLUDER) { - ob->body_type = OB_BODY_TYPE_OCCLUDER; - } - else if (ob->gameflag & OB_NAVMESH) { - ob->body_type = OB_BODY_TYPE_NAVMESH; - } - else { - ob->body_type = OB_BODY_TYPE_NO_COLLISION; - } - } - else if (ob->gameflag & OB_CHARACTER) { - ob->body_type = OB_BODY_TYPE_CHARACTER; - } - else if (ob->gameflag & OB_SENSOR) { - ob->body_type = OB_BODY_TYPE_SENSOR; - } - else if (!(ob->gameflag & OB_DYNAMIC)) { - ob->body_type = OB_BODY_TYPE_STATIC; - } - else if (!(ob->gameflag & (OB_RIGID_BODY | OB_SOFT_BODY))) { - ob->body_type = OB_BODY_TYPE_DYNAMIC; - } - else if (ob->gameflag & OB_RIGID_BODY) { - ob->body_type = OB_BODY_TYPE_RIGID; - } - else { - ob->body_type = OB_BODY_TYPE_SOFT; - /* create the structure here because we display soft body buttons in the main panel */ - if (!ob->bsoft) - ob->bsoft = bsbNew(); - } - - return ob->body_type; -} - -static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) -{ - Object *ob = (Object *)ptr->id.data; - const int gameflag_prev = ob->gameflag; - ob->body_type = value; - - switch (ob->body_type) { - case OB_BODY_TYPE_SENSOR: - ob->gameflag |= OB_SENSOR | OB_COLLISION; - ob->gameflag &= ~(OB_OCCLUDER | OB_CHARACTER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR | - OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH); - break; - case OB_BODY_TYPE_OCCLUDER: - ob->gameflag |= OB_OCCLUDER; - ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_DYNAMIC | OB_NAVMESH); - break; - case OB_BODY_TYPE_NAVMESH: - ob->gameflag |= OB_NAVMESH; - ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_DYNAMIC | OB_OCCLUDER); - - if (ob->type == OB_MESH) { - /* could be moved into mesh UI but for now ensure mesh data layer */ - BKE_mesh_ensure_navmesh(ob->data); - } - - break; - case OB_BODY_TYPE_NO_COLLISION: - ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_OCCLUDER | OB_DYNAMIC | OB_NAVMESH); - break; - case OB_BODY_TYPE_CHARACTER: - ob->gameflag |= OB_COLLISION | OB_CHARACTER; - ob->gameflag &= ~(OB_SENSOR | OB_OCCLUDER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR | - OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH); - /* When we switch to character physics and the collision bounds is set to triangle mesh - * we have to change collision bounds because triangle mesh is not supported by Characters */ - if ((ob->gameflag & OB_BOUNDS) && ob->collision_boundtype == OB_BOUND_TRIANGLE_MESH) { - ob->boundtype = ob->collision_boundtype = OB_BOUND_BOX; - } - break; - case OB_BODY_TYPE_STATIC: - ob->gameflag |= OB_COLLISION; - ob->gameflag &= ~(OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH); - break; - case OB_BODY_TYPE_DYNAMIC: - ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_ACTOR; - ob->gameflag &= ~(OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH); - break; - case OB_BODY_TYPE_RIGID: - ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_RIGID_BODY | OB_ACTOR; - ob->gameflag &= ~(OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH); - break; - default: - case OB_BODY_TYPE_SOFT: - ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_SOFT_BODY | OB_ACTOR; - ob->gameflag &= ~(OB_RIGID_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH); - - /* assume triangle mesh, if no bounds chosen for soft body */ - if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype < OB_BOUND_TRIANGLE_MESH)) { - ob->boundtype = OB_BOUND_TRIANGLE_MESH; - } - /* create a BulletSoftBody structure if not already existing */ - if (!ob->bsoft) - ob->bsoft = bsbNew(); - break; - } - - if ((gameflag_prev & OB_NAVMESH) != (ob->gameflag & OB_NAVMESH)) { - if (ob->type == OB_MESH) { - /* this is needed to refresh the derived meshes draw func */ - DEG_id_tag_update(ptr->id.data, OB_RECALC_DATA); - } - } - - WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data); -} static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr) { @@ -1171,117 +1014,6 @@ static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys); } -static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr) -{ - return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data); -} - -static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values) -{ - Object *ob = (Object *)ptr->data; - int i; - int all_states = (ob->scaflag & OB_ALLSTATE) ? 1 : 0; - - memset(values, 0, sizeof(int) * OB_MAX_STATES); - for (i = 0; i < OB_MAX_STATES; i++) { - values[i] = (ob->state & (1 << i)) ? 1 : 0 | all_states; - } -} - -static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values) -{ - Object *ob = (Object *)ptr->data; - int i, tot = 0; - - /* ensure we always have some state selected */ - for (i = 0; i < OB_MAX_STATES; i++) - if (values[i]) - tot++; - - if (tot == 0) - return; - - for (i = 0; i < OB_MAX_STATES; i++) { - if (values[i]) ob->state |= (1 << i); - else ob->state &= ~(1 << i); - } -} - -static void rna_GameObjectSettings_used_state_get(PointerRNA *ptr, int *values) -{ - Object *ob = (Object *)ptr->data; - bController *cont; - - memset(values, 0, sizeof(int) * OB_MAX_STATES); - for (cont = ob->controllers.first; cont; cont = cont->next) { - int i; - - for (i = 0; i < OB_MAX_STATES; i++) { - if (cont->state_mask & (1 << i)) - values[i] = 1; - } - } -} - -static void rna_GameObjectSettings_col_group_get(PointerRNA *ptr, int *values) -{ - Object *ob = (Object *)ptr->data; - int i; - - for (i = 0; i < OB_MAX_COL_MASKS; i++) { - values[i] = (ob->col_group & (1 << i)) != 0; - } -} - -static void rna_GameObjectSettings_col_group_set(PointerRNA *ptr, const int *values) -{ - Object *ob = (Object *)ptr->data; - int i, tot = 0; - - /* ensure we always have some group selected */ - for (i = 0; i < OB_MAX_COL_MASKS; i++) - if (values[i]) - tot++; - - if (tot == 0) - return; - - for (i = 0; i < OB_MAX_COL_MASKS; i++) { - if (values[i]) ob->col_group |= (1 << i); - else ob->col_group &= ~(1 << i); - } -} - -static void rna_GameObjectSettings_col_mask_get(PointerRNA *ptr, int *values) -{ - Object *ob = (Object *)ptr->data; - int i; - - for (i = 0; i < OB_MAX_COL_MASKS; i++) { - values[i] = (ob->col_mask & (1 << i)) != 0; - } -} - -static void rna_GameObjectSettings_col_mask_set(PointerRNA *ptr, const int *values) -{ - Object *ob = (Object *)ptr->data; - int i, tot = 0; - - /* ensure we always have some mask selected */ - for (i = 0; i < OB_MAX_COL_MASKS; i++) - if (values[i]) - tot++; - - if (tot == 0) - return; - - for (i = 0; i < OB_MAX_COL_MASKS; i++) { - if (values[i]) ob->col_mask |= (1 << i); - else ob->col_mask &= ~(1 << i); - } -} - - static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) { @@ -1617,16 +1349,6 @@ int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr) return (ss && ss->bm); } -static void rna_Object_lod_distance_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - Object *ob = (Object *)ptr->id.data; - -#ifdef WITH_GAMEENGINE - BKE_object_lod_sort(ob); -#else - (void)ob; -#endif -} #else static void rna_def_vertex_group(BlenderRNA *brna) @@ -1777,313 +1499,6 @@ static void rna_def_material_slot(BlenderRNA *brna) RNA_def_struct_path_func(srna, "rna_MaterialSlot_path"); } -static void rna_def_object_game_settings(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem body_type_items[] = { - {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable collision for this object"}, - {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", "Stationary object"}, - {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", "Linear physics"}, - {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"}, - {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"}, - {OB_BODY_TYPE_OCCLUDER, "OCCLUDER", 0, "Occluder", "Occluder for optimizing scene rendering"}, - {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", - "Collision Sensor, detects static and dynamic objects but not the other " - "collision sensor objects"}, - {OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"}, - {OB_BODY_TYPE_CHARACTER, "CHARACTER", 0, "Character", - "Simple kinematic physics appropriate for game characters"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "GameObjectSettings", NULL); - RNA_def_struct_sdna(srna, "Object"); - RNA_def_struct_nested(brna, srna, "Object"); - RNA_def_struct_ui_text(srna, "Game Object Settings", "Game engine related settings for the object"); - RNA_def_struct_ui_icon(srna, ICON_GAME); - - /* logic */ - - prop = RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_type(prop, "Sensor"); - RNA_def_property_ui_text(prop, "Sensors", "Game engine sensor to detect events"); - - prop = RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_type(prop, "Controller"); - RNA_def_property_ui_text(prop, "Controllers", - "Game engine controllers to process events, connecting sensors to actuators"); - - prop = RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_type(prop, "Actuator"); - RNA_def_property_ui_text(prop, "Actuators", "Game engine actuators to act on events"); - - prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "prop", NULL); - RNA_def_property_struct_type(prop, "GameProperty"); /* rna_property.c */ - RNA_def_property_ui_text(prop, "Properties", "Game engine properties"); - - prop = RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSENS); - RNA_def_property_ui_text(prop, "Show Sensors", "Shows sensors for this object in the user interface"); - - prop = RNA_def_property(srna, "show_controllers", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWCONT); - RNA_def_property_ui_text(prop, "Show Controllers", "Shows controllers for this object in the user interface"); - - prop = RNA_def_property(srna, "show_actuators", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWACT); - RNA_def_property_ui_text(prop, "Show Actuators", "Shows actuators for this object in the user interface"); - - /* physics */ - - prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "body_type"); - RNA_def_property_enum_items(prop, body_type_items); - RNA_def_property_enum_default(prop, OB_BODY_TYPE_STATIC); - RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", - "rna_GameObjectSettings_physics_type_set", NULL); - RNA_def_property_ui_text(prop, "Physics Type", "Select the type of physical representation"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_record_animation", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_RECORD_ANIMATION); - RNA_def_property_ui_text(prop, "Record Animation", "Record animation objects without physics"); - - prop = RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR); - RNA_def_property_ui_text(prop, "Actor", "Object is detected by the Near and Radar sensor"); - - prop = RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST); - RNA_def_property_ui_text(prop, "Ghost", "Object does not react to collisions, like a ghost"); - - prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01, 10000.0); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Mass", "Mass of the object"); - - prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH); - RNA_def_property_float_sdna(prop, NULL, "inertia"); - RNA_def_property_range(prop, 0.01f, FLT_MAX); - RNA_def_property_ui_range(prop, 0.01f, 10.0f, 1, 3); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Radius", "Radius of bounding sphere and material physics"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "use_sleep", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_COLLISION_RESPONSE); - RNA_def_property_ui_text(prop, "No Sleeping", "Disable auto (de)activation in physics simulation"); - - prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "damping"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_default(prop, 0.04f); - RNA_def_property_ui_text(prop, "Damping", "General movement damping"); - - prop = RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "rdamping"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_default(prop, 0.1f); - RNA_def_property_ui_text(prop, "Rotation Damping", "General rotation damping"); - - prop = RNA_def_property(srna, "velocity_min", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "min_vel"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Velocity Min", "Clamp velocity to this minimum speed (except when totally still), " - "in distance per second"); - - prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "max_vel"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed, " - "in distance per second"); - - prop = RNA_def_property(srna, "angular_velocity_min", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "min_angvel"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Angular Velocity Min", - "Clamp angular velocity to this minimum speed (except when totally still), " - "in angle per second"); - - prop = RNA_def_property(srna, "angular_velocity_max", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "max_angvel"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Angular Velocity Max", "Clamp angular velocity to this maximum speed, " - "in angle per second"); - - /* Character physics */ - prop = RNA_def_property(srna, "step_height", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "step_height"); - RNA_def_property_range(prop, 0.01, 1.0); - RNA_def_property_float_default(prop, 0.15f); - RNA_def_property_ui_text(prop, "Step Height", "Maximum height of steps the character can run over"); - - prop = RNA_def_property(srna, "jump_speed", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "jump_speed"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_float_default(prop, 10.0f); - RNA_def_property_ui_text(prop, "Jump Force", "Upward velocity applied to the character when jumping"); - - prop = RNA_def_property(srna, "fall_speed", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "fall_speed"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_float_default(prop, 55.0f); - RNA_def_property_ui_text(prop, "Fall Speed Max", "Maximum speed at which the character will fall"); - - prop = RNA_def_property(srna, "jump_max", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "max_jumps"); - RNA_def_property_range(prop, 1, CHAR_MAX); - RNA_def_property_ui_range(prop, 1, 10, 1, 1); - RNA_def_property_int_default(prop, 1); - RNA_def_property_ui_text(prop, "Max Jumps", - "The maximum number of jumps the character can make before it hits the ground"); - - /* Collision Masks */ - prop = RNA_def_property(srna, "collision_group", PROP_BOOLEAN, PROP_LAYER_MEMBER); - RNA_def_property_boolean_sdna(prop, NULL, "col_group", 1); - RNA_def_property_array(prop, OB_MAX_COL_MASKS); - RNA_def_property_ui_text(prop, "Collision Group", "The collision group of the object"); - RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_group_get", "rna_GameObjectSettings_col_group_set"); - - prop = RNA_def_property(srna, "collision_mask", PROP_BOOLEAN, PROP_LAYER_MEMBER); - RNA_def_property_boolean_sdna(prop, NULL, "col_mask", 1); - RNA_def_property_array(prop, OB_MAX_COL_MASKS); - RNA_def_property_ui_text(prop, "Collision Mask", "The groups this object can collide with"); - RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_mask_get", "rna_GameObjectSettings_col_mask_set"); - - /* lock position */ - prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_AXIS); - RNA_def_property_ui_text(prop, "Lock X Axis", "Disable simulation of linear motion along the X axis"); - - prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_AXIS); - RNA_def_property_ui_text(prop, "Lock Y Axis", "Disable simulation of linear motion along the Y axis"); - - prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_AXIS); - RNA_def_property_ui_text(prop, "Lock Z Axis", "Disable simulation of linear motion along the Z axis"); - - - /* lock rotation */ - prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis"); - - prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis"); - - prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); - - /* is this used anywhere ? */ - prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); - - - prop = RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH); - RNA_def_property_ui_text(prop, "Use Material Force Field", "React to force field physics settings in materials"); - - prop = RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH); - RNA_def_property_ui_text(prop, "Rotate From Normal", - "Use face normal to rotate object, so that it points away from the surface"); - - prop = RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "formfactor"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_default(prop, 0.4f); - RNA_def_property_ui_text(prop, "Form Factor", "Form factor scales the inertia tensor"); - - prop = RNA_def_property(srna, "use_anisotropic_friction", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ANISOTROPIC_FRICTION); - RNA_def_property_ui_text(prop, "Anisotropic Friction", "Enable anisotropic friction"); - - prop = RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_XYZ); - RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_ui_text(prop, "Friction Coefficients", - "Relative friction coefficients in the in the X, Y and Z directions, " - "when anisotropic friction is enabled"); - - prop = RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS); - RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "collision_boundtype"); - RNA_def_property_enum_items(prop, collision_bounds_items); - RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf"); - RNA_def_property_ui_text(prop, "Collision Shape", "Select the collision shape that better fits the object"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - - prop = RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_CHILD); - RNA_def_property_ui_text(prop, "Collision Compound", "Add children to form a compound collision object"); - - prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH); - RNA_def_property_float_sdna(prop, NULL, "margin"); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_default(prop, 0.04f); - RNA_def_property_ui_text(prop, "Collision Margin", - "Extra margin around object for collision detection, small amount required " - "for stability"); - - prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "bsoft"); - RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation"); - - prop = RNA_def_property(srna, "use_obstacle_create", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_HASOBSTACLE); - RNA_def_property_ui_text(prop, "Create obstacle", "Create representation for obstacle simulation"); - - prop = RNA_def_property(srna, "obstacle_radius", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH); - RNA_def_property_float_sdna(prop, NULL, "obstacleRad"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Obstacle Radius", "Radius of object representation in obstacle simulation"); - - /* state */ - - prop = RNA_def_property(srna, "states_visible", PROP_BOOLEAN, PROP_LAYER_MEMBER); - RNA_def_property_boolean_sdna(prop, NULL, "state", 1); - RNA_def_property_array(prop, OB_MAX_STATES); - RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed"); - RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_state_get", "rna_GameObjectSettings_state_set"); - - prop = RNA_def_property(srna, "used_states", PROP_BOOLEAN, PROP_LAYER_MEMBER); - RNA_def_property_array(prop, OB_MAX_STATES); - RNA_def_property_ui_text(prop, "Used State", "States which are being used by controllers"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_used_state_get", NULL); - - prop = RNA_def_property(srna, "states_initial", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "init_state", 1); - RNA_def_property_array(prop, OB_MAX_STATES); - RNA_def_property_ui_text(prop, "Initial State", "Initial state when the game starts"); - - prop = RNA_def_property(srna, "show_debug_state", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_DEBUGSTATE); - RNA_def_property_ui_text(prop, "Debug State", "Print state debug info in the game engine"); - RNA_def_property_ui_icon(prop, ICON_INFO, 0); - - prop = RNA_def_property(srna, "use_all_states", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_ALLSTATE); - RNA_def_property_ui_text(prop, "All", "Set all state bits"); - - prop = RNA_def_property(srna, "show_state_panel", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSTATE); - RNA_def_property_ui_text(prop, "States", "Show state panel"); - RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1); -} - static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; @@ -2312,54 +1727,6 @@ static void rna_def_object_face_maps(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Delete all vertex groups from object"); } -static void rna_def_object_lodlevel(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "LodLevel", NULL); - RNA_def_struct_sdna(srna, "LodLevel"); - - prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "distance"); - RNA_def_property_range(prop, 0.0, FLT_MAX); - RNA_def_property_ui_text(prop, "Distance", "Distance to begin using this level of detail"); - RNA_def_property_update(prop, NC_OBJECT | ND_LOD, "rna_Object_lod_distance_update"); - - prop = RNA_def_property(srna, "object_hysteresis_percentage", PROP_INT, PROP_PERCENTAGE); - RNA_def_property_int_sdna(prop, NULL, "obhysteresis"); - RNA_def_property_range(prop, 0, 100); - RNA_def_property_ui_range(prop, 0, 100, 10, 1); - RNA_def_property_ui_text(prop, "Hysteresis %", - "Minimum distance change required to transition to the previous level of detail"); - RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); - - prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "source"); - 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 this level of detail"); - RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); - - prop = RNA_def_property(srna, "use_mesh", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_MESH); - RNA_def_property_ui_text(prop, "Use Mesh", "Use the mesh from this object at this level of detail"); - RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0); - RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); - - prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_MAT); - RNA_def_property_ui_text(prop, "Use Material", "Use the material from this object at this level of detail"); - RNA_def_property_ui_icon(prop, ICON_MATERIAL, 0); - RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); - - prop = RNA_def_property(srna, "use_object_hysteresis", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_HYST); - RNA_def_property_ui_text(prop, "Hysteresis Override", "Override LoD Hysteresis scene setting for this LoD level"); - RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); -} - - static void rna_def_object(BlenderRNA *brna) { StructRNA *srna; @@ -2710,13 +2077,6 @@ static void rna_def_object(BlenderRNA *brna) /* RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove"); */ rna_def_object_constraints(brna, prop); - /* game engine */ - prop = RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_struct_type(prop, "GameObjectSettings"); - RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object"); - /* vertex groups */ prop = RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL); @@ -3040,13 +2400,6 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL); - /* Levels of Detail */ - prop = RNA_def_property(srna, "lod_levels", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "lodlevels", NULL); - RNA_def_property_struct_type(prop, "LodLevel"); - RNA_def_property_ui_text(prop, "Level of Detail Levels", "A collection of detail levels to automatically switch between"); - RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL); - /* Base Settings */ prop = RNA_def_property(srna, "is_from_duplicator", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROMDUPLI); @@ -3124,13 +2477,11 @@ void RNA_def_object(BlenderRNA *brna) rna_def_object(brna); RNA_define_animate_sdna(false); - rna_def_object_game_settings(brna); rna_def_vertex_group(brna); rna_def_face_map(brna); rna_def_material_slot(brna); rna_def_dupli_object(brna); RNA_define_animate_sdna(true); - rna_def_object_lodlevel(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 7d062d41e4f..3a61accfad3 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1459,78 +1459,6 @@ static void rna_def_field(BlenderRNA *brna) /* falloff_power, use_max_distance, maximum_distance */ } -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, "linear_stiffness", 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, "shape_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, "collision_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, "weld_threshold", PROP_FLOAT, PROP_DISTANCE); - 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, "location_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", "Number of cluster iterations"); - - /* Booleans */ - - prop = RNA_def_property(srna, "use_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, "use_bending_constraints", 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, "use_cluster_rigid_to_softbody", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_RS); - RNA_def_property_ui_text(prop, "Rigid to Soft Body", "Enable cluster collision between soft and rigid body"); - - prop = RNA_def_property(srna, "use_cluster_soft_to_softbody", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_SS); - RNA_def_property_ui_text(prop, "Soft to Soft Body", "Enable cluster collision between soft and soft body"); -} - static void rna_def_softbody(BlenderRNA *brna) { StructRNA *srna; @@ -1851,7 +1779,6 @@ void RNA_def_object_force(BlenderRNA *brna) rna_def_collision(brna); rna_def_effector_weight(brna); rna_def_field(brna); - rna_def_game_softbody(brna); rna_def_softbody(brna); } diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c deleted file mode 100644 index 7ee792b5d1f..00000000000 --- a/source/blender/makesrna/intern/rna_property.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * ***** 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_property.c - * \ingroup RNA - */ - - -#include <stdlib.h> - -#include "DNA_property_types.h" -#include "DNA_object_types.h" - -#include "BLI_path_util.h" -#include "BLI_string_utils.h" - -#include "BLT_translation.h" - -#include "RNA_define.h" -#include "RNA_enum_types.h" - -#include "rna_internal.h" - - -#include "WM_types.h" - -const EnumPropertyItem rna_enum_gameproperty_type_items[] = { - {GPROP_BOOL, "BOOL", 0, "Boolean", "Boolean Property"}, - {GPROP_INT, "INT", 0, "Integer", "Integer Property"}, - {GPROP_FLOAT, "FLOAT", 0, "Float", "Floating-Point Property"}, - {GPROP_STRING, "STRING", 0, "String", "String Property"}, - {GPROP_TIME, "TIMER", 0, "Timer", "Timer Property"}, - {0, NULL, 0, NULL, NULL} -}; - - -#ifdef RNA_RUNTIME - -#include "BKE_property.h" - -static StructRNA *rna_GameProperty_refine(struct PointerRNA *ptr) -{ - bProperty *property = (bProperty *)ptr->data; - - switch (property->type) { - case GPROP_BOOL: - return &RNA_GameBooleanProperty; - case GPROP_INT: - return &RNA_GameIntProperty; - case GPROP_FLOAT: - return &RNA_GameFloatProperty; - case GPROP_STRING: - return &RNA_GameStringProperty; - case GPROP_TIME: - return &RNA_GameTimerProperty; - default: - return &RNA_GameProperty; - } -} - -/* for both float and timer */ -static float rna_GameFloatProperty_value_get(PointerRNA *ptr) -{ - bProperty *prop = (bProperty *)(ptr->data); - return *(float *)(&prop->data); -} - -static void rna_GameFloatProperty_value_set(PointerRNA *ptr, float value) -{ - bProperty *prop = (bProperty *)(ptr->data); - CLAMP(value, -10000.0f, 10000.0f); - *(float *)(&prop->data) = value; -} - -static void rna_GameProperty_type_set(PointerRNA *ptr, int value) -{ - bProperty *prop = (bProperty *)(ptr->data); - - if (prop->type != value) { - prop->type = value; - BKE_bproperty_init(prop); - } -} - -static void rna_GameProperty_name_set(PointerRNA *ptr, const char *value) -{ - Object *ob = ptr->id.data; - bProperty *prop = ptr->data; - BLI_strncpy_utf8(prop->name, value, sizeof(prop->name)); - - BLI_uniquename(&ob->prop, prop, DATA_("Property"), '.', offsetof(bProperty, name), sizeof(prop->name)); -} - - -#else - -void RNA_def_gameproperty(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - /* Base Struct for GameProperty */ - srna = RNA_def_struct(brna, "GameProperty", NULL); - RNA_def_struct_ui_text(srna, "Game Property", "Game engine user defined object property"); - RNA_def_struct_sdna(srna, "bProperty"); - RNA_def_struct_refine_func(srna, "rna_GameProperty_refine"); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Name", "Available as GameObject attributes in the game engine's python API"); - RNA_def_struct_name_property(srna, prop); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GameProperty_name_set"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, rna_enum_gameproperty_type_items); - RNA_def_property_ui_text(prop, "Type", ""); - RNA_def_property_enum_funcs(prop, NULL, "rna_GameProperty_type_set", NULL); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_debug", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", PROP_DEBUG); - RNA_def_property_ui_text(prop, "Debug", "Print debug information for this property"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* GameBooleanProperty */ - srna = RNA_def_struct(brna, "GameBooleanProperty", "GameProperty"); - RNA_def_struct_ui_text(srna, "Game Boolean Property", "Game engine user defined Boolean property"); - RNA_def_struct_sdna(srna, "bProperty"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "data", 1); - RNA_def_property_ui_text(prop, "Value", "Property value"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* GameIntProperty */ - srna = RNA_def_struct(brna, "GameIntProperty", "GameProperty"); - RNA_def_struct_ui_text(srna, "Game Integer Property", "Game engine user defined integer number property"); - RNA_def_struct_sdna(srna, "bProperty"); - - prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "data"); - RNA_def_property_ui_text(prop, "Value", "Property value"); - RNA_def_property_range(prop, -10000, 10000); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* GameFloatProperty */ - srna = RNA_def_struct(brna, "GameFloatProperty", "GameProperty"); - RNA_def_struct_ui_text(srna, "Game Float Property", "Game engine user defined floating point number property"); - RNA_def_struct_sdna(srna, "bProperty"); - - prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); - /* RNA_def_property_float_sdna(prop, NULL, "data"); */ - RNA_def_property_ui_text(prop, "Value", "Property value"); - RNA_def_property_range(prop, -10000, 10000); - RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* GameTimerProperty */ - srna = RNA_def_struct(brna, "GameTimerProperty", "GameProperty"); - RNA_def_struct_ui_text(srna, "Game Timer Property", "Game engine user defined timer property"); - RNA_def_struct_sdna(srna, "bProperty"); - - prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); - /* RNA_def_property_float_sdna(prop, NULL, "data"); */ - RNA_def_property_ui_text(prop, "Value", "Property value"); - RNA_def_property_range(prop, -10000, 10000); - RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* GameStringProperty */ - srna = RNA_def_struct(brna, "GameStringProperty", "GameProperty"); - RNA_def_struct_ui_text(srna, "Game String Property", "Game engine user defined text string property"); - RNA_def_struct_sdna(srna, "bProperty"); - - prop = RNA_def_property(srna, "value", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "poin"); - RNA_def_property_string_maxlength(prop, MAX_PROPSTRING); - RNA_def_property_ui_text(prop, "Value", "Property value"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -#endif - diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1032acbae67..2e842687831 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1627,27 +1627,6 @@ static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value) } } -static int rna_GameSettings_auto_start_get(PointerRNA *UNUSED(ptr)) -{ - return (G.fileflags & G_FILE_AUTOPLAY) != 0; -} - -static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value) -{ - if (value) - G.fileflags |= G_FILE_AUTOPLAY; - else - G.fileflags &= ~G_FILE_AUTOPLAY; -} - -static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value) -{ - GameData *gm = (GameData *)ptr->data; - - if (ISKEYBOARD(value)) - gm->exitkey = value; -} - static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame) { TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); @@ -3941,124 +3920,6 @@ void rna_def_freestyle_settings(BlenderRNA *brna) rna_def_freestyle_linesets(brna, prop); } -static void rna_def_scene_game_recast_data(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem rna_enum_partitioning_items[] = { - {RC_PARTITION_WATERSHED, "WATERSHED", 0, "Watershed", "Classic Recast partitioning method generating the nicest tessellation"}, - {RC_PARTITION_MONOTONE, "MONOTONE", 0, "Monotone", "Fastest navmesh generation method, may create long thin polygons"}, - {RC_PARTITION_LAYERS, "LAYERS", 0, "Layers", "Reasonably fast method that produces better triangles than monotone partitioning"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "SceneGameRecastData", NULL); - RNA_def_struct_sdna(srna, "RecastData"); - RNA_def_struct_nested(brna, srna, "Scene"); - RNA_def_struct_ui_text(srna, "Recast Data", "Recast data for a Game data-block"); - - prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "cellsize"); - RNA_def_property_ui_range(prop, 0.1, 1, 1, 2); - RNA_def_property_float_default(prop, 0.3f); - RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "cellheight"); - RNA_def_property_ui_range(prop, 0.1, 1, 1, 2); - RNA_def_property_float_default(prop, 0.2f); - RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "agentheight"); - RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); - RNA_def_property_float_default(prop, 2.0f); - RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "agentradius"); - RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); - RNA_def_property_float_default(prop, 0.6f); - RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb"); - RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); - RNA_def_property_float_default(prop, 0.9f); - RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_float_sdna(prop, NULL, "agentmaxslope"); - RNA_def_property_range(prop, 0, M_PI_2); - RNA_def_property_float_default(prop, M_PI_4); - RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - - prop = RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "regionminsize"); - RNA_def_property_ui_range(prop, 0, 150, 1, 2); - RNA_def_property_float_default(prop, 8.0f); - RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "regionmergesize"); - RNA_def_property_ui_range(prop, 0, 150, 1, 2); - RNA_def_property_float_default(prop, 20.0f); - RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "partitioning", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "partitioning"); - RNA_def_property_enum_items(prop, rna_enum_partitioning_items); - RNA_def_property_enum_default(prop, RC_PARTITION_WATERSHED); - RNA_def_property_ui_text(prop, "Partitioning", "Choose partitioning method"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "edgemaxlen"); - RNA_def_property_ui_range(prop, 0, 50, 1, 2); - RNA_def_property_float_default(prop, 12.0f); - RNA_def_property_ui_text(prop, "Max Edge Length", "Maximum contour edge length"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "edgemaxerror"); - RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2); - RNA_def_property_float_default(prop, 1.3f); - RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "vertsperpoly"); - RNA_def_property_ui_range(prop, 3, 12, 1, -1); - RNA_def_property_int_default(prop, 6); - RNA_def_property_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "detailsampledist"); - RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2); - RNA_def_property_float_default(prop, 6.0f); - RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror"); - RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error"); - RNA_def_property_update(prop, NC_SCENE, NULL); -} - - static void rna_def_bake_data(BlenderRNA *brna) { StructRNA *srna; @@ -4222,493 +4083,6 @@ static void rna_def_bake_data(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); } -static void rna_def_scene_game_data(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem aasamples_items[] = { - {0, "SAMPLES_0", 0, "Off", ""}, - {2, "SAMPLES_2", 0, "2x", ""}, - {4, "SAMPLES_4", 0, "4x", ""}, - {8, "SAMPLES_8", 0, "8x", ""}, - {16, "SAMPLES_16", 0, "16x", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem framing_types_items[] = { - {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", - "Show the entire viewport in the display window, using bar horizontally or vertically"}, - {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", - "Show the entire viewport in the display window, viewing more horizontally " - "or vertically"}, - {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem dome_modes_items[] = { - {DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""}, - {DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""}, - {DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""}, - {DOME_ENVMAP, "ENVMAP", 0, "Cube Map", ""}, - {DOME_PANORAM_SPH, "PANORAM_SPH", 0, "Spherical Panoramic", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem stereo_modes_items[] = { - {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""}, - {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""}, - {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""}, - {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""}, - {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""}, - {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""}, - {STEREO_3DTVTOPBOTTOM, "3DTVTOPBOTTOM", 0, "3DTV Top-Bottom", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem stereo_items[] = { - {STEREO_NOSTEREO, "NONE", 0, "None", "Disable Stereo and Dome environments"}, - {STEREO_ENABLED, "STEREO", 0, "Stereo", "Enable Stereo environment"}, - {STEREO_DOME, "DOME", 0, "Dome", "Enable Dome environment"}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem physics_engine_items[] = { - {WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"}, - {WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem material_items[] = { - {GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials"}, - {GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders"}, - {0, NULL, 0, NULL, NULL} - }; - - static const 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)", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem vsync_items[] = { - {VSYNC_OFF, "OFF", 0, "Off", "Disable vsync"}, - {VSYNC_ON, "ON", 0, "On", "Enable vsync"}, - {VSYNC_ADAPTIVE, "ADAPTIVE", 0, "Adaptive", "Enable adaptive vsync (if supported)"}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem storage_items[] = { - {RAS_STORE_AUTO, "AUTO", 0, "Auto Select", "Choose the best supported mode"}, - {RAS_STORE_VA, "VERTEX_ARRAY", 0, "Vertex Arrays", "Usually the best choice (good performance with display lists)"}, - {RAS_STORE_VBO, "VERTEX_BUFFER_OBJECT", 0, "Vertex Buffer Objects", - "Typically slower than vertex arrays with display lists, requires at least OpenGL 1.4"}, - {0, NULL, 0, NULL, NULL}}; - - srna = RNA_def_struct(brna, "SceneGameData", NULL); - RNA_def_struct_sdna(srna, "GameData"); - RNA_def_struct_nested(brna, srna, "Scene"); - RNA_def_struct_ui_text(srna, "Game Data", "Game data for a Scene data-block"); - - prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL); - RNA_def_property_int_sdna(prop, NULL, "xplay"); - RNA_def_property_range(prop, 4, 10000); - RNA_def_property_int_default(prop, 640); - RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL); - RNA_def_property_int_sdna(prop, NULL, "yplay"); - RNA_def_property_range(prop, 4, 10000); - RNA_def_property_int_default(prop, 480); - RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "vsync", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "vsync"); - RNA_def_property_enum_items(prop, vsync_items); - RNA_def_property_ui_text(prop, "Vsync", "Change vsync settings"); - - prop = RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "aasamples"); - RNA_def_property_enum_items(prop, aasamples_items); - RNA_def_property_ui_text(prop, "AA Samples", "The number of AA Samples to use for MSAA"); - - prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_sdna(prop, NULL, "depth"); - RNA_def_property_range(prop, 8, 32); - RNA_def_property_int_default(prop, 32); - RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "exitkey"); - RNA_def_property_enum_items(prop, rna_enum_event_type_items); - RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); - RNA_def_property_enum_default(prop, ESCKEY); - RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL); - RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "raster_storage", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "raster_storage"); - RNA_def_property_enum_items(prop, storage_items); - RNA_def_property_ui_text(prop, "Storage", "Set the storage mode used by the rasterizer"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - /* Do we need it here ? (since we already have it in World */ - prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "freqplay"); - RNA_def_property_range(prop, 4, 2000); - RNA_def_property_int_default(prop, 60); - RNA_def_property_ui_text(prop, "Freq", "Display clock frequency of fullscreen display"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_FULLSCREEN); - RNA_def_property_ui_text(prop, "Fullscreen", "Start player in a new fullscreen display"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_DESKTOP_RESOLUTION); - RNA_def_property_ui_text(prop, "Desktop", "Use the current desktop resolution in fullscreen mode"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - /* Framing */ - prop = RNA_def_property(srna, "frame_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "framing.type"); - RNA_def_property_enum_items(prop, framing_types_items); - RNA_def_property_ui_text(prop, "Framing Types", "Select the type of Framing you want"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "frame_color", PROP_FLOAT, PROP_COLOR); - RNA_def_property_float_sdna(prop, NULL, "framing.col"); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Framing Color", "Set color of the bars"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - /* Stereo */ - prop = RNA_def_property(srna, "stereo", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "stereoflag"); - RNA_def_property_enum_items(prop, stereo_items); - RNA_def_property_ui_text(prop, "Stereo Options", ""); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "stereomode"); - RNA_def_property_enum_items(prop, stereo_modes_items); - RNA_def_property_enum_default(prop, STEREO_ANAGLYPH); - RNA_def_property_ui_text(prop, "Stereo Mode", "Stereographic techniques"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "eyeseparation"); - RNA_def_property_range(prop, 0.01, 5.0); - RNA_def_property_float_default(prop, 0.1f); - RNA_def_property_ui_text(prop, "Eye Separation", - "Set the distance between the eyes - the camera focal distance/30 should be fine"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - /* Dome */ - prop = RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "dome.mode"); - RNA_def_property_enum_items(prop, dome_modes_items); - RNA_def_property_ui_text(prop, "Dome Mode", "Dome physical configurations"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "dome_tessellation", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "dome.res"); - RNA_def_property_ui_range(prop, 1, 8, 1, 1); - RNA_def_property_int_default(prop, 4); - RNA_def_property_ui_text(prop, "Tessellation", "Tessellation level - check the generated mesh in wireframe mode"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "dome.resbuf"); - RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 2); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "dome.angle"); - RNA_def_property_ui_range(prop, 90, 250, 1, 1); - RNA_def_property_int_default(prop, 180); - RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "dome_tilt", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "dome.tilt"); - RNA_def_property_ui_range(prop, -180, 180, 1, 1); - RNA_def_property_ui_text(prop, "Tilt", "Camera rotation in horizontal axis"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "dome_text", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "dome.warptext"); - RNA_def_property_struct_type(prop, "Text"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Warp Data", "Custom Warp Mesh data file"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - /* physics */ - prop = RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "physicsEngine"); - RNA_def_property_enum_items(prop, physics_engine_items); - RNA_def_property_enum_default(prop, WOPHY_BULLET); - RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_ACCELERATION); - RNA_def_property_float_sdna(prop, NULL, "gravity"); - RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2); - RNA_def_property_range(prop, 0.0, 10000.0); - RNA_def_property_float_default(prop, 9.8f); - RNA_def_property_ui_text(prop, "Physics Gravity", - "Gravitational constant used for physics simulation in the game engine"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_PIXEL); - RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); - RNA_def_property_range(prop, 128.0, 1024.0); - RNA_def_property_int_default(prop, 128); - RNA_def_property_ui_text(prop, "Occlusion Resolution", - "Size of the occlusion buffer, use higher value for better precision (slower)"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "ticrate"); - RNA_def_property_ui_range(prop, 1, 60, 1, 1); - RNA_def_property_range(prop, 1, 10000); - RNA_def_property_int_default(prop, 60); - RNA_def_property_ui_text(prop, "Frames Per Second", - "Nominal number of game frames per second " - "(physics fixed timestep = 1/fps, independently of actual frame rate)"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "maxlogicstep"); - RNA_def_property_range(prop, 1, 10000); - RNA_def_property_ui_range(prop, 1, 50, 1, 1); - RNA_def_property_int_default(prop, 5); - RNA_def_property_ui_text(prop, "Max Logic Steps", - "Maximum number of logic frame per game frame if graphics slows down the game, " - "higher value allows better synchronization with physics"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "maxphystep"); - RNA_def_property_range(prop, 1, 10000); - RNA_def_property_ui_range(prop, 1, 50, 1, 1); - RNA_def_property_int_default(prop, 5); - RNA_def_property_ui_text(prop, "Max Physics Steps", - "Maximum number of physics step per game frame if graphics slows down the game, " - "higher value allows physics to keep up with realtime"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "physubstep"); - RNA_def_property_range(prop, 1, 50); - RNA_def_property_ui_range(prop, 1, 5, 1, 1); - RNA_def_property_int_default(prop, 1); - RNA_def_property_ui_text(prop, "Physics Sub Steps", - "Number of simulation substep per physic timestep, " - "higher value give better physics precision"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "deactivation_linear_threshold", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "lineardeactthreshold"); - RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3); - RNA_def_property_range(prop, 0.001, 10000.0); - RNA_def_property_float_default(prop, 0.8f); - RNA_def_property_ui_text(prop, "Deactivation Linear Threshold", - "Linear velocity that an object must be below before the deactivation timer can start"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "deactivation_angular_threshold", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "angulardeactthreshold"); - RNA_def_property_ui_range(prop, 0.001, 10000.0, 2, 3); - RNA_def_property_range(prop, 0.001, 10000.0); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, "Deactivation Angular Threshold", - "Angular velocity that an object must be below before the deactivation timer can start"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "deactivation_time", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "deactivationtime"); - RNA_def_property_ui_range(prop, 0.0, 60.0, 1, 1); - RNA_def_property_range(prop, 0.0, 60.0); - RNA_def_property_ui_text(prop, "Deactivation Time", - "Amount of time (in seconds) after which objects with a velocity less than the given " - "threshold will deactivate (0.0 means no deactivation)"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - /* mode */ - /* not used *//* deprecated !!!!!!!!!!!!! */ - prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_DBVT_CULLING); - RNA_def_property_ui_text(prop, "DBVT Culling", - "Use optimized Bullet DBVT tree for view frustum and occlusion culling (more efficient, " - "but it can waste unnecessary CPU if the scene doesn't have occluder objects)"); - - /* not used *//* deprecated !!!!!!!!!!!!! */ - prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_ACTIVITY_CULLING); - RNA_def_property_ui_text(prop, "Activity Culling", "Activity culling is enabled"); - - /* not used *//* deprecated !!!!!!!!!!!!! */ - prop = RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius"); - RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Box Radius", - "Radius of the activity bubble, in Manhattan length " - "(objects outside the box are activity-culled)"); - - /* booleans */ - prop = RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_DEBUG_PROPS); - RNA_def_property_ui_text(prop, "Show Debug Properties", - "Show properties marked for debugging while the game runs"); - - prop = RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE); - RNA_def_property_ui_text(prop, "Show Framerate and Profile", - "Show framerate and profiling information while the game runs"); - - prop = RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS); - RNA_def_property_ui_text(prop, "Show Physics Visualization", - "Show a visualization of physics bounds and interactions"); - - prop = RNA_def_property(srna, "show_mouse", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_MOUSE); - RNA_def_property_ui_text(prop, "Show Mouse", "Start player with a visible mouse cursor"); - - prop = RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES); - RNA_def_property_ui_text(prop, "Use Frame Rate", - "Respect the frame rate from the Physics panel in the world properties " - "rather than rendering as many frames as possible"); - - prop = RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS); - RNA_def_property_ui_text(prop, "Deprecation Warnings", - "Print warnings when using deprecated features in the python API"); - - prop = RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD); - RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves"); - - prop = RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set"); - RNA_def_property_ui_text(prop, "Auto Start", "Automatically start game at load time"); - - prop = RNA_def_property(srna, "use_restrict_animation_updates", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES); - RNA_def_property_ui_text(prop, "Restrict Animation Updates", - "Restrict the number of animation updates to the animation FPS (this is " - "better for performance, but can cause issues with smooth playback)"); - - /* materials */ - prop = RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "matmode"); - RNA_def_property_enum_items(prop, material_items); - RNA_def_property_ui_text(prop, "Material Mode", "Material mode to use for rendering"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, NULL); - - prop = RNA_def_property(srna, "use_glsl_lights", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_LIGHTS); - RNA_def_property_ui_text(prop, "GLSL Lights", "Use lights for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); - - prop = RNA_def_property(srna, "use_glsl_shaders", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADERS); - RNA_def_property_ui_text(prop, "GLSL Shaders", "Use shaders for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); - - prop = RNA_def_property(srna, "use_glsl_shadows", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADOWS); - RNA_def_property_ui_text(prop, "GLSL Shadows", "Use shadows for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); - - prop = RNA_def_property(srna, "use_glsl_ramps", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_RAMPS); - RNA_def_property_ui_text(prop, "GLSL Ramps", "Use ramps for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); - - prop = RNA_def_property(srna, "use_glsl_nodes", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_NODES); - RNA_def_property_ui_text(prop, "GLSL Nodes", "Use nodes for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); - - prop = RNA_def_property(srna, "use_glsl_color_management", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_COLOR_MANAGEMENT); - RNA_def_property_ui_text(prop, "GLSL Color Management", "Use color management for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); - - prop = RNA_def_property(srna, "use_glsl_extra_textures", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_EXTRA_TEX); - RNA_def_property_ui_text(prop, "GLSL Extra Textures", - "Use extra textures like normal or specular maps for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); - - prop = RNA_def_property(srna, "use_glsl_environment_lighting", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_ENV_LIGHTING); - RNA_def_property_ui_text(prop, "GLSL Environment Lighting", "Use environment lighting for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_glsl_update"); - - prop = RNA_def_property(srna, "use_material_caching", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_NO_MATERIAL_CACHING); - RNA_def_property_ui_text(prop, "Use Material Caching", - "Cache materials in the converter (this is faster, but can cause problems with older " - "Singletexture and Multitexture games)"); - - /* obstacle simulation */ - prop = RNA_def_property(srna, "obstacle_simulation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "obstacleSimulation"); - RNA_def_property_enum_items(prop, obstacle_simulation_items); - RNA_def_property_ui_text(prop, "Obstacle simulation", "Simulation used for obstacle avoidance in the game engine"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "level_height", PROP_FLOAT, PROP_ACCELERATION); - RNA_def_property_float_sdna(prop, NULL, "levelHeight"); - RNA_def_property_range(prop, 0.0f, 200.0f); - RNA_def_property_float_default(prop, 2.0f); - RNA_def_property_ui_text(prop, "Level height", - "Max difference in heights of obstacles to enable their interaction"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "show_obstacle_simulation", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_OBSTACLE_SIMULATION); - RNA_def_property_ui_text(prop, "Visualization", "Enable debug visualization for obstacle simulation"); - - /* Recast Settings */ - prop = RNA_def_property(srna, "recast_data", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "recastData"); - RNA_def_property_struct_type(prop, "SceneGameRecastData"); - RNA_def_property_ui_text(prop, "Recast Data", ""); - - /* Nestled Data */ - rna_def_scene_game_recast_data(brna); - - /* LoD */ - prop = RNA_def_property(srna, "use_scene_hysteresis", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "lodflag", SCE_LOD_USE_HYST); - RNA_def_property_ui_text(prop, "Hysteresis", "Use LoD Hysteresis setting for the scene"); - RNA_def_property_update(prop, NC_SCENE, NULL); - - prop = RNA_def_property(srna, "scene_hysteresis_percentage", PROP_INT, PROP_PERCENTAGE); - RNA_def_property_int_sdna(prop, NULL, "scehysteresis"); - RNA_def_property_range(prop, 0, 100); - RNA_def_property_ui_range(prop, 0, 100, 10, 1); - RNA_def_property_int_default(prop, 10); - RNA_def_property_ui_text(prop, "Hysteresis %", - "Minimum distance change required to transition to the previous level of detail"); - RNA_def_property_update(prop, NC_SCENE, NULL); -} - static void rna_def_gpu_dof_fx(BlenderRNA *brna) { StructRNA *srna; @@ -6950,13 +6324,6 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE, NULL); RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL); - /* Game Settings */ - prop = RNA_def_property(srna, "game_settings", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "gm"); - RNA_def_property_struct_type(prop, "SceneGameData"); - RNA_def_property_ui_text(prop, "Game Data", ""); - /* Statistics */ func = RNA_def_function(srna, "statistics", "ED_info_stats_string"); parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Active layer"); @@ -7020,7 +6387,6 @@ void RNA_def_scene(BlenderRNA *brna) rna_def_statvis(brna); rna_def_unit_settings(brna); rna_def_scene_image_format_data(brna); - rna_def_scene_game_data(brna); rna_def_selected_uv_element(brna); rna_def_display_safe_areas(brna); RNA_define_animate_sdna(true); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c deleted file mode 100644 index 735df471721..00000000000 --- a/source/blender/makesrna/intern/rna_sensor.c +++ /dev/null @@ -1,939 +0,0 @@ -/* - * ***** 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_sensor.c - * \ingroup RNA - */ - -#include <stdlib.h> - -#include "DNA_constraint_types.h" -#include "DNA_object_types.h" -#include "DNA_sensor_types.h" - -#include "BLI_utildefines.h" -#include "BLI_math.h" -#include "BLI_string_utils.h" - -#include "BLT_translation.h" - -#include "RNA_define.h" -#include "RNA_enum_types.h" -#include "RNA_access.h" - -#include "rna_internal.h" - -#include "WM_types.h" - -/* Always keep in alphabetical order */ -static const EnumPropertyItem sensor_type_items[] = { - {SENS_ACTUATOR, "ACTUATOR", 0, "Actuator", ""}, - {SENS_ALWAYS, "ALWAYS", 0, "Always", ""}, - {SENS_ARMATURE, "ARMATURE", 0, "Armature", ""}, - {SENS_COLLISION, "COLLISION", 0, "Collision", ""}, - {SENS_DELAY, "DELAY", 0, "Delay", ""}, - {SENS_JOYSTICK, "JOYSTICK", 0, "Joystick", ""}, - {SENS_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""}, - {SENS_MESSAGE, "MESSAGE", 0, "Message", ""}, - {SENS_MOUSE, "MOUSE", 0, "Mouse", ""}, - {SENS_NEAR, "NEAR", 0, "Near", ""}, - {SENS_PROPERTY, "PROPERTY", 0, "Property", ""}, - {SENS_RADAR, "RADAR", 0, "Radar", ""}, - {SENS_RANDOM, "RANDOM", 0, "Random", ""}, - {SENS_RAY, "RAY", 0, "Ray", ""}, - {0, NULL, 0, NULL, NULL} -}; - -#ifdef RNA_RUNTIME - -#include "BKE_sca.h" -#include "DNA_controller_types.h" - -static StructRNA *rna_Sensor_refine(struct PointerRNA *ptr) -{ - bSensor *sensor = (bSensor *)ptr->data; - - switch (sensor->type) { - case SENS_ALWAYS: - return &RNA_AlwaysSensor; - case SENS_NEAR: - return &RNA_NearSensor; - case SENS_KEYBOARD: - return &RNA_KeyboardSensor; - case SENS_PROPERTY: - return &RNA_PropertySensor; - case SENS_ARMATURE: - return &RNA_ArmatureSensor; - case SENS_MOUSE: - return &RNA_MouseSensor; - case SENS_COLLISION: - return &RNA_CollisionSensor; - case SENS_RADAR: - return &RNA_RadarSensor; - case SENS_RANDOM: - return &RNA_RandomSensor; - case SENS_RAY: - return &RNA_RaySensor; - case SENS_MESSAGE: - return &RNA_MessageSensor; - case SENS_JOYSTICK: - return &RNA_JoystickSensor; - case SENS_ACTUATOR: - return &RNA_ActuatorSensor; - case SENS_DELAY: - return &RNA_DelaySensor; - default: - return &RNA_Sensor; - } -} - -static void rna_Sensor_name_set(PointerRNA *ptr, const char *value) -{ - Object *ob = ptr->id.data; - bSensor *sens = ptr->data; - BLI_strncpy_utf8(sens->name, value, sizeof(sens->name)); - BLI_uniquename(&ob->sensors, sens, DATA_("Sensor"), '.', offsetof(bSensor, name), sizeof(sens->name)); -} - -static void rna_Sensor_type_set(struct PointerRNA *ptr, int value) -{ - bSensor *sens = (bSensor *)ptr->data; - if (value != sens->type) { - sens->type = value; - init_sensor(sens); - } -} - -/* Always keep in alphabetical order */ - -static void rna_Sensor_controllers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) -{ - bSensor *sens = (bSensor *)ptr->data; - rna_iterator_array_begin(iter, sens->links, sizeof(bController *), (int)sens->totlinks, 0, NULL); -} - -static int rna_Sensor_controllers_length(PointerRNA *ptr) -{ - bSensor *sens = (bSensor *)ptr->data; - return (int) sens->totlinks; -} - -const EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) -{ - EnumPropertyItem *item = NULL; - Object *ob = NULL; - int totitem = 0; - - if (ptr->type == &RNA_Sensor || RNA_struct_is_a(ptr->type, &RNA_Sensor)) { - ob = (Object *)ptr->id.data; - } - else { - /* can't use ob from ptr->id.data because that enum is also used by operators */ - ob = CTX_data_active_object(C); - } - - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ACTUATOR); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ALWAYS); - - if (ob != NULL) { - if (ob->type == OB_ARMATURE) { - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ARMATURE); - } - } - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_DELAY); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_JOYSTICK); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_KEYBOARD); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_MESSAGE); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_MOUSE); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_NEAR); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_PROPERTY); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RADAR); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RANDOM); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RAY); - RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH); - - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; -} - -static void rna_Sensor_keyboard_key_set(struct PointerRNA *ptr, int value) -{ - bSensor *sens = (bSensor *)ptr->data; - bKeyboardSensor *ks = (bKeyboardSensor *)sens->data; - - if (ISKEYBOARD(value)) - ks->key = value; - else - ks->key = 0; -} - -static void rna_Sensor_keyboard_modifier_set(struct PointerRNA *ptr, int value) -{ - bSensor *sens = (bSensor *)ptr->data; - bKeyboardSensor *ks = (bKeyboardSensor *)sens->data; - - if (ISKEYBOARD(value)) - ks->qual = value; - else - ks->qual = 0; -} - -static void rna_Sensor_keyboard_modifier2_set(struct PointerRNA *ptr, int value) -{ - bSensor *sens = (bSensor *)ptr->data; - bKeyboardSensor *ks = (bKeyboardSensor *)sens->data; - - if (ISKEYBOARD(value)) - ks->qual2 = value; - else - ks->qual2 = 0; -} - -static void rna_Sensor_tap_set(struct PointerRNA *ptr, int value) -{ - bSensor *sens = (bSensor *)ptr->data; - - sens->tap = value; - if (sens->tap == 1) - sens->level = 0; -} - -static void rna_Sensor_level_set(struct PointerRNA *ptr, int value) -{ - bSensor *sens = (bSensor *)ptr->data; - - sens->level = value; - if (sens->level == 1) - sens->tap = 0; -} - -static void rna_Sensor_Armature_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) -{ - bSensor *sens = (bSensor *)ptr->data; - bArmatureSensor *as = sens->data; - Object *ob = (Object *)ptr->id.data; - - char *posechannel = as->posechannel; - char *constraint = as->constraint; - - /* check that bone exist in the active object */ - if (ob->type == OB_ARMATURE && ob->pose) { - bPoseChannel *pchan; - bPose *pose = ob->pose; - for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { - if (STREQ(pchan->name, posechannel)) { - /* found it, now look for constraint channel */ - bConstraint *con; - for (con = pchan->constraints.first; con; con = con->next) { - if (STREQ(con->name, constraint)) { - /* found it, all ok */ - return; - } - } - /* didn't find constraint, make empty */ - constraint[0] = 0; - return; - } - } - } - /* didn't find any */ - posechannel[0] = 0; - constraint[0] = 0; -} -#else - -static void rna_def_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "Sensor", NULL); - RNA_def_struct_ui_text(srna, "Sensor", "Game engine logic brick to detect events"); - RNA_def_struct_sdna(srna, "bSensor"); - RNA_def_struct_refine_func(srna, "rna_Sensor_refine"); - - prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Name", "Sensor name"); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Sensor_name_set"); - RNA_def_struct_name_property(srna, prop); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_enum_items(prop, sensor_type_items); - RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_type_set", "rna_Sensor_type_itemf"); - RNA_def_property_ui_text(prop, "Type", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_PIN); - RNA_def_property_ui_text(prop, "Pinned", "Display when not linked to a visible states controller"); - RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SENS_DEACTIVATE); - RNA_def_property_ui_text(prop, "Active", "Set active state of the sensor"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_SHOW); - RNA_def_property_ui_text(prop, "Expanded", "Set sensor expanded in the user interface"); - RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Invert Output", "Invert the level(output) of this sensor"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_level", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "level", 1); - RNA_def_property_ui_text(prop, "Level", - "Level detector, trigger controllers of new states " - "(only applicable upon logic state transition)"); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_level_set"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_pulse_true_level", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_PULSE_REPEAT); - RNA_def_property_ui_text(prop, "Pulse True Level", "Activate TRUE level triggering (pulse mode)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_pulse_false_level", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_NEG_PULSE_MODE); - RNA_def_property_ui_text(prop, "Pulse False Level", "Activate FALSE level triggering (pulse mode)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "tick_skip", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "freq"); - RNA_def_property_ui_text(prop, "Skip", - "Number of logic ticks skipped between 2 active pulses " - "(0 = pulse every logic tick, 1 = skip 1 logic tick between pulses, etc.)"); - RNA_def_property_range(prop, 0, 10000); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_tap", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "tap", 1); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_tap_set"); - RNA_def_property_ui_text(prop, "Tap", - "Trigger controllers only for an instant, even while the sensor remains true"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "links", NULL); - RNA_def_property_struct_type(prop, "Controller"); - RNA_def_property_ui_text(prop, "Controllers", "The list containing the controllers connected to the sensor"); - RNA_def_property_collection_funcs(prop, "rna_Sensor_controllers_begin", "rna_iterator_array_next", - "rna_iterator_array_end", "rna_iterator_array_dereference_get", - "rna_Sensor_controllers_length", NULL, NULL, NULL); - - - RNA_api_sensor(srna); -} - -static void rna_def_always_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - srna = RNA_def_struct(brna, "AlwaysSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Always Sensor", "Sensor to generate continuous pulses"); -} - -static void rna_def_near_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "NearSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Near Sensor", "Sensor to detect nearby objects"); - RNA_def_struct_sdna_from(srna, "bNearSensor", "data"); - - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "dist"); - RNA_def_property_ui_text(prop, "Distance", "Trigger distance"); - RNA_def_property_range(prop, 0.0f, 10000.0f); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "reset_distance", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "resetdist"); - RNA_def_property_ui_text(prop, "Reset Distance", "The distance where the sensor forgets the actor"); - RNA_def_property_range(prop, 0.0f, 10000.0f); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_mouse_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem mouse_event_items[] = { - {BL_SENS_MOUSE_LEFT_BUTTON, "LEFTCLICK", 0, "Left Button", ""}, - {BL_SENS_MOUSE_MIDDLE_BUTTON, "MIDDLECLICK", 0, "Middle Button", ""}, - {BL_SENS_MOUSE_RIGHT_BUTTON, "RIGHTCLICK", 0, "Right Button", ""}, - {BL_SENS_MOUSE_WHEEL_UP, "WHEELUP", 0, "Wheel Up", ""}, - {BL_SENS_MOUSE_WHEEL_DOWN, "WHEELDOWN", 0, "Wheel Down", ""}, - {BL_SENS_MOUSE_MOVEMENT, "MOVEMENT", 0, "Movement", ""}, - {BL_SENS_MOUSE_MOUSEOVER, "MOUSEOVER", 0, "Mouse Over", ""}, - {BL_SENS_MOUSE_MOUSEOVER_ANY, "MOUSEOVERANY", 0, "Mouse Over Any", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_mouse_type_items[] = { - {SENS_COLLISION_PROPERTY, "PROPERTY", ICON_LOGIC, "Property", "Use a property for ray intersections"}, - {SENS_COLLISION_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Use a material for ray intersections"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "MouseSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Mouse Sensor", "Sensor to detect mouse events"); - RNA_def_struct_sdna_from(srna, "bMouseSensor", "data"); - - prop = RNA_def_property(srna, "mouse_event", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, mouse_event_items); - RNA_def_property_ui_text(prop, "Mouse Event", "Type of event this mouse sensor should trigger on"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_pulse", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_MOUSE_FOCUS_PULSE); - RNA_def_property_ui_text(prop, "Pulse", "Moving the mouse over a different object generates a pulse"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_material", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode"); - RNA_def_property_enum_items(prop, prop_mouse_type_items); - RNA_def_property_ui_text(prop, "M/P", "Toggle collision on material or property"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "propname"); - RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "matname"); - RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_x_ray", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_RAY_XRAY); - RNA_def_property_ui_text(prop, "X-Ray", "Toggle X-Ray option (see through objects that don't have the property)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_keyboard_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "KeyboardSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Keyboard Sensor", "Sensor to detect keyboard events"); - RNA_def_struct_sdna_from(srna, "bKeyboardSensor", "data"); - - prop = RNA_def_property(srna, "key", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "key"); - RNA_def_property_enum_items(prop, rna_enum_event_type_items); - RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); - RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_key_set", NULL); - RNA_def_property_ui_text(prop, "Key", ""); - RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_WINDOWMANAGER); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "modifier_key_1", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "qual"); - RNA_def_property_enum_items(prop, rna_enum_event_type_items); - RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); - RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier_set", NULL); - RNA_def_property_ui_text(prop, "Modifier Key", "Modifier key code"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "modifier_key_2", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "qual2"); - RNA_def_property_enum_items(prop, rna_enum_event_type_items); - RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); - RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier2_set", NULL); - RNA_def_property_ui_text(prop, "Second Modifier Key", "Modifier key code"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "target", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "targetName"); - RNA_def_property_ui_text(prop, "Target", "Property that receives the keystrokes in case a string is logged"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "log", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "toggleName"); - RNA_def_property_ui_text(prop, "Log Toggle", "Property that indicates whether to log keystrokes as a string"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_all_keys", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "type", 1); - RNA_def_property_ui_text(prop, "All Keys", "Trigger this sensor on any keystroke"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_property_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - static const EnumPropertyItem prop_type_items[] = { - {SENS_PROP_EQUAL, "PROPEQUAL", 0, "Equal", ""}, - {SENS_PROP_NEQUAL, "PROPNEQUAL", 0, "Not Equal", ""}, - {SENS_PROP_INTERVAL, "PROPINTERVAL", 0, "Interval", ""}, - {SENS_PROP_CHANGED, "PROPCHANGED", 0, "Changed", ""}, - /* {SENS_PROP_EXPRESSION, "PROPEXPRESSION", 0, "Expression", ""}, NOT_USED_IN_UI */ - {SENS_PROP_LESSTHAN, "PROPLESSTHAN", 0, "Less Than", ""}, - {SENS_PROP_GREATERTHAN, "PROPGREATERTHAN", 0, "Greater Than", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "PropertySensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Property Sensor", "Sensor to detect values and changes in values of properties"); - RNA_def_struct_sdna_from(srna, "bPropertySensor", "data"); - - prop = RNA_def_property(srna, "evaluation_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Evaluation Type", "Type of property evaluation"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "Property", ""); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "value", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "value"); - RNA_def_property_ui_text(prop, "Value", "Check for this value in types in Equal, Not Equal, Less Than and Greater Than types"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "value_min", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "value"); - RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value in Interval type"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "value_max", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "maxvalue"); - RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value in Interval type"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_armature_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - static const EnumPropertyItem prop_type_items[] = { - {SENS_ARM_STATE_CHANGED, "STATECHG", 0, "State Changed", ""}, - {SENS_ARM_LIN_ERROR_BELOW, "LINERRORBELOW", 0, "Lin error below", ""}, - {SENS_ARM_LIN_ERROR_ABOVE, "LINERRORABOVE", 0, "Lin error above", ""}, - {SENS_ARM_ROT_ERROR_BELOW, "ROTERRORBELOW", 0, "Rot error below", ""}, - {SENS_ARM_ROT_ERROR_ABOVE, "ROTERRORABOVE", 0, "Rot error above", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "ArmatureSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Armature Sensor", "Sensor to detect values and changes in values of IK solver"); - RNA_def_struct_sdna_from(srna, "bArmatureSensor", "data"); - - prop = RNA_def_property(srna, "test_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Test", "Type of value and test"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "posechannel"); - RNA_def_property_ui_text(prop, "Bone Name", "Identify the bone to check value from"); - RNA_def_property_update(prop, NC_LOGIC, "rna_Sensor_Armature_update"); - - prop = RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "constraint"); - RNA_def_property_ui_text(prop, "Constraint Name", "Identify the bone constraint to check value from"); - RNA_def_property_update(prop, NC_LOGIC, "rna_Sensor_Armature_update"); - - prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "value"); - RNA_def_property_ui_text(prop, "Compare Value", "Value to be used in comparison"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_actuator_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "ActuatorSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Actuator Sensor", "Sensor to detect state modifications of actuators"); - RNA_def_struct_sdna_from(srna, "bActuatorSensor", "data"); - - /* XXX if eventually have Logics using RNA 100%, we could use the actuator data-block isntead of its name */ - prop = RNA_def_property(srna, "actuator", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "Actuator", "Actuator name, actuator active state modifications will be detected"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_delay_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "DelaySensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Delay Sensor", "Sensor to send delayed events"); - RNA_def_struct_sdna_from(srna, "bDelaySensor", "data"); - - prop = RNA_def_property(srna, "delay", PROP_INT, PROP_NONE); - RNA_def_property_ui_text(prop, "Delay", - "Delay in number of logic tics before the positive trigger (default 60 per second)"); - RNA_def_property_range(prop, 0, 5000); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "duration", PROP_INT, PROP_NONE); - RNA_def_property_ui_text(prop, "Duration", - "If >0, delay in number of logic tics before the negative trigger following " - "the positive trigger"); - RNA_def_property_range(prop, 0, 5000); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_repeat", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_DELAY_REPEAT); - RNA_def_property_ui_text(prop, "Repeat", - "Toggle repeat option (if selected, the sensor restarts after Delay+Duration " - "logic tics)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_collision_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "CollisionSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Collision Sensor", - "Sensor to detect objects colliding with the current object, with more settings than " - "the Touch sensor"); - RNA_def_struct_sdna_from(srna, "bCollisionSensor", "data"); - - prop = RNA_def_property(srna, "use_pulse", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_PULSE); - RNA_def_property_ui_text(prop, "Pulse", "Change to the set of colliding objects generates pulse"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL); - RNA_def_property_ui_text(prop, "M/P", "Toggle collision on material or property"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /*XXX to make a setFunction to create a lookup with all materials in Blend File (not only this object mat.) */ - prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "materialName"); - RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - -#if 0 - /* XXX either use a data-block look up to store the string name (material) - * or to do a doversion and use a material pointer. */ - prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Material"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_pointer_sdna(prop, NULL, "ma"); - RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)"); -#endif -} - -static void rna_def_radar_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - static const EnumPropertyItem axis_items[] = { - {SENS_RADAR_X_AXIS, "XAXIS", 0, "+X axis", ""}, - {SENS_RADAR_Y_AXIS, "YAXIS", 0, "+Y axis", ""}, - {SENS_RADAR_Z_AXIS, "ZAXIS", 0, "+Z axis", ""}, - {SENS_RADAR_NEG_X_AXIS, "NEGXAXIS", 0, "-X axis", ""}, - {SENS_RADAR_NEG_Y_AXIS, "NEGYAXIS", 0, "-Y axis", ""}, - {SENS_RADAR_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "RadarSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Radar Sensor", - "Sensor to detect objects in a cone shaped radar emanating from the current object"); - RNA_def_struct_sdna_from(srna, "bRadarSensor", "data"); - - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "name"); - RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, axis_items); - RNA_def_property_ui_text(prop, "Axis", "Along which axis the radar cone is cast"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_range(prop, 0.0, DEG2RADF(179.9f)); - RNA_def_property_ui_text(prop, "Angle", "Opening angle of the radar cone"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "range"); - RNA_def_property_range(prop, 0.0, 10000.0); - RNA_def_property_ui_text(prop, "Distance", "Depth of the radar cone"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_random_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "RandomSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Random Sensor", "Sensor to send random events"); - RNA_def_struct_sdna_from(srna, "bRandomSensor", "data"); - - prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, 1000); - RNA_def_property_ui_text(prop, "Seed", "Initial seed of the generator (choose 0 for not random)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_ray_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - static const EnumPropertyItem axis_items[] = { - {SENS_RAY_X_AXIS, "XAXIS", 0, "+X axis", ""}, - {SENS_RAY_Y_AXIS, "YAXIS", 0, "+Y axis", ""}, - {SENS_RAY_Z_AXIS, "ZAXIS", 0, "+Z axis", ""}, - {SENS_RAY_NEG_X_AXIS, "NEGXAXIS", 0, "-X axis", ""}, - {SENS_RAY_NEG_Y_AXIS, "NEGYAXIS", 0, "-Y axis", ""}, - {SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem prop_ray_type_items[] = { - {SENS_COLLISION_PROPERTY, "PROPERTY", ICON_LOGIC, "Property", "Use a property for ray intersections"}, - {SENS_COLLISION_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Use a material for ray intersections"}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "RaySensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Ray Sensor", - "Sensor to detect intersections with a ray emanating from the current object"); - RNA_def_struct_sdna_from(srna, "bRaySensor", "data"); - - prop = RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode"); - RNA_def_property_enum_items(prop, prop_ray_type_items); - RNA_def_property_ui_text(prop, "Ray Type", "Toggle collision on material or property"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "propname"); - RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE); - RNA_def_property_string_sdna(prop, NULL, "matname"); - RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - -#if 0 - /* XXX either use a data-block look up to store the string name (material) - * or to do a doversion and use a material pointer. */ - prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Material"); - RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_pointer_sdna(prop, NULL, "ma"); - RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)"); -#endif - - prop = RNA_def_property(srna, "use_x_ray", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_RAY_XRAY); - RNA_def_property_ui_text(prop, "X-Ray Mode", - "Toggle X-Ray option (see through objects that don't have the property)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01, 10000.0); - RNA_def_property_ui_text(prop, "Range", "Sense objects no farther than this distance"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "axisflag"); - RNA_def_property_enum_items(prop, axis_items); - RNA_def_property_ui_text(prop, "Axis", "Along which axis the ray is cast"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_message_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "MessageSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Message Sensor", "Sensor to detect incoming messages"); - RNA_def_struct_sdna_from(srna, "bMessageSensor", "data"); - - prop = RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE); - RNA_def_property_ui_text(prop, "Subject", - "Optional subject filter: only accept messages with this subject, " - "or empty to accept all"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -static void rna_def_joystick_sensor(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static const EnumPropertyItem event_type_joystick_items[] = { - {SENS_JOY_BUTTON, "BUTTON", 0, "Button", ""}, - {SENS_JOY_AXIS, "AXIS", 0, "Axis", ""}, - {SENS_JOY_HAT, "HAT", 0, "Hat", ""}, - {SENS_JOY_AXIS_SINGLE, "AXIS_SINGLE", 0, "Single Axis", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem axis_direction_items[] = { - {SENS_JOY_X_AXIS, "RIGHTAXIS", 0, "Right Axis", ""}, - {SENS_JOY_Y_AXIS, "UPAXIS", 0, "Up Axis", ""}, - {SENS_JOY_NEG_X_AXIS, "LEFTAXIS", 0, "Left Axis", ""}, - {SENS_JOY_NEG_Y_AXIS, "DOWNAXIS", 0, "Down Axis", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static const EnumPropertyItem hat_direction_items[] = { - {SENS_JOY_HAT_UP, "UP", 0, "Up", ""}, - {SENS_JOY_HAT_DOWN, "DOWN", 0, "Down", ""}, - {SENS_JOY_HAT_LEFT, "LEFT", 0, "Left", ""}, - {SENS_JOY_HAT_RIGHT, "RIGHT", 0, "Right", ""}, - - {SENS_JOY_HAT_UP_RIGHT, "UPRIGHT", 0, "Up/Right", ""}, - {SENS_JOY_HAT_DOWN_LEFT, "DOWNLEFT", 0, "Down/Left", ""}, - {SENS_JOY_HAT_UP_LEFT, "UPLEFT", 0, "Up/Left", ""}, - {SENS_JOY_HAT_DOWN_RIGHT, "DOWNRIGHT", 0, "Down/Right", ""}, - {0, NULL, 0, NULL, NULL} - }; - - srna = RNA_def_struct(brna, "JoystickSensor", "Sensor"); - RNA_def_struct_ui_text(srna, "Joystick Sensor", "Sensor to detect joystick events"); - RNA_def_struct_sdna_from(srna, "bJoystickSensor", "data"); - - prop = RNA_def_property(srna, "joystick_index", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "joyindex"); - RNA_def_property_ui_text(prop, "Index", "Which joystick to use"); - RNA_def_property_range(prop, 0, SENS_JOY_MAXINDEX - 1); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "event_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, event_type_joystick_items); - RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); - RNA_def_property_ui_text(prop, "Event Type", "The type of event this joystick sensor is triggered on"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "use_all_events", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_JOY_ANY_EVENT); - RNA_def_property_ui_text(prop, "All Events", - "Triggered by all events on this joystick's current type (axis/button/hat)"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Button */ - prop = RNA_def_property(srna, "button_number", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "button"); - RNA_def_property_ui_text(prop, "Button Number", "Which button to use"); - RNA_def_property_range(prop, 0, 18); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Axis */ - prop = RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "axis"); - RNA_def_property_ui_text(prop, "Axis Number", "Which axis pair to use, 1 is usually the main direction input"); - RNA_def_property_range(prop, 1, 8); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "precision"); - RNA_def_property_ui_text(prop, "Axis Threshold", "Precision of the axis"); - RNA_def_property_range(prop, 0, 32768); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "axis_direction", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "axisf"); - RNA_def_property_enum_items(prop, axis_direction_items); - RNA_def_property_ui_text(prop, "Axis Direction", "The direction of the axis"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Single Axis */ - prop = RNA_def_property(srna, "single_axis_number", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "axis_single"); - RNA_def_property_ui_text(prop, "Axis Number", "Single axis (vertical/horizontal/other) to detect"); - RNA_def_property_range(prop, 1, 16); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* Hat */ - prop = RNA_def_property(srna, "hat_number", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "hat"); - RNA_def_property_ui_text(prop, "Hat Number", "Which hat to use"); - RNA_def_property_range(prop, 1, 2); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "hat_direction", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "hatf"); - RNA_def_property_enum_items(prop, hat_direction_items); - RNA_def_property_ui_text(prop, "Hat Direction", "Hat direction"); - RNA_def_property_update(prop, NC_LOGIC, NULL); -} - -void RNA_def_sensor(BlenderRNA *brna) -{ - rna_def_sensor(brna); - - rna_def_always_sensor(brna); - rna_def_near_sensor(brna); - rna_def_mouse_sensor(brna); - rna_def_keyboard_sensor(brna); - rna_def_property_sensor(brna); - rna_def_armature_sensor(brna); - rna_def_actuator_sensor(brna); - rna_def_delay_sensor(brna); - rna_def_collision_sensor(brna); - rna_def_radar_sensor(brna); - rna_def_random_sensor(brna); - rna_def_ray_sensor(brna); - rna_def_message_sensor(brna); - rna_def_joystick_sensor(brna); -} - -#endif diff --git a/source/blender/makesrna/intern/rna_sensor_api.c b/source/blender/makesrna/intern/rna_sensor_api.c deleted file mode 100644 index b0c4109b1df..00000000000 --- a/source/blender/makesrna/intern/rna_sensor_api.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * ***** 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. - * - * The Original Code is Copyright (C) 2010 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/makesrna/intern/rna_sensor_api.c - * \ingroup RNA - */ - -#include <stdlib.h> -#include <stdio.h> - -#include "BLI_utildefines.h" - -#include "RNA_define.h" - -#include "rna_internal.h" /* own include */ - -#include "WM_types.h" - -#ifdef RNA_RUNTIME - -#include "BKE_sca.h" -#include "DNA_sensor_types.h" -#include "DNA_controller_types.h" - -static void rna_Sensor_link(bSensor *sens, bController *cont) -{ - link_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks, sizeof(bController *)); -} - -static void rna_Sensor_unlink(bSensor *sens, bController *cont) -{ - unlink_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks); -} - -#else - -void RNA_api_sensor(StructRNA *srna) -{ - FunctionRNA *func; - PropertyRNA *parm; - - func = RNA_def_function(srna, "link", "rna_Sensor_link"); - RNA_def_function_ui_description(func, "Link the sensor to a controller"); - parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - RNA_def_property_update(parm, NC_LOGIC, NULL); - - func = RNA_def_function(srna, "unlink", "rna_Sensor_unlink"); - RNA_def_function_ui_description(func, "Unlink the sensor from a controller"); - parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - RNA_def_property_update(parm, NC_LOGIC, NULL); -} - -#endif - diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index 6aacede5816..0c1391fd2f7 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -32,7 +32,6 @@ #include "rna_internal.h" #include "DNA_sound_types.h" -#include "DNA_property_types.h" #ifdef RNA_RUNTIME diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index a12b4553486..1252091f84b 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -83,7 +83,6 @@ const EnumPropertyItem rna_enum_space_type_items[] = { /* Scripting */ {0, "", ICON_NONE, "Scripting", ""}, {SPACE_TEXT, "TEXT_EDITOR", ICON_TEXT, "Text Editor", "Edit scripts and in-file documentation"}, - {SPACE_LOGIC, "LOGIC_EDITOR", ICON_LOGIC, "Logic Editor", "Game logic editing"}, {SPACE_CONSOLE, "CONSOLE", ICON_CONSOLE, "Python Console", "Interactive programmatic console for " "advanced editing and script development"}, {SPACE_INFO, "INFO", ICON_INFO, "Info", "Main menu bar and list of error messages " @@ -329,8 +328,6 @@ static StructRNA *rna_Space_refine(struct PointerRNA *ptr) return &RNA_SpaceTimeline; case SPACE_NODE: return &RNA_SpaceNodeEditor; - case SPACE_LOGIC: - return &RNA_SpaceLogicEditor; case SPACE_CONSOLE: return &RNA_SpaceConsole; case SPACE_USERPREF: @@ -4350,75 +4347,6 @@ static void rna_def_space_node(BlenderRNA *brna) RNA_api_space_node(srna); } -static void rna_def_space_logic(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "SpaceLogicEditor", "Space"); - RNA_def_struct_sdna(srna, "SpaceLogic"); - RNA_def_struct_ui_text(srna, "Space Logic Editor", "Logic editor space data"); - - /* sensors */ - prop = RNA_def_property(srna, "show_sensors_selected_objects", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_SEL); - RNA_def_property_ui_text(prop, "Show Selected Object", "Show sensors of all selected objects"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_sensors_active_object", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_ACT); - RNA_def_property_ui_text(prop, "Show Active Object", "Show sensors of active object"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_sensors_linked_controller", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_LINK); - RNA_def_property_ui_text(prop, "Show Linked to Controller", "Show linked objects to the controller"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_sensors_active_states", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_STATE); - RNA_def_property_ui_text(prop, "Show Active States", "Show only sensors connected to active states"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* controllers */ - prop = RNA_def_property(srna, "show_controllers_selected_objects", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_SEL); - RNA_def_property_ui_text(prop, "Show Selected Object", "Show controllers of all selected objects"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_controllers_active_object", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_ACT); - RNA_def_property_ui_text(prop, "Show Active Object", "Show controllers of active object"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_controllers_linked_controller", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_LINK); - RNA_def_property_ui_text(prop, "Show Linked to Controller", "Show linked objects to sensor/actuator"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - /* actuators */ - prop = RNA_def_property(srna, "show_actuators_selected_objects", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_SEL); - RNA_def_property_ui_text(prop, "Show Selected Object", "Show actuators of all selected objects"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_actuators_active_object", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_ACT); - RNA_def_property_ui_text(prop, "Show Active Object", "Show actuators of active object"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_actuators_linked_controller", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_LINK); - RNA_def_property_ui_text(prop, "Show Linked to Actuator", "Show linked objects to the actuator"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - - prop = RNA_def_property(srna, "show_actuators_active_states", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_STATE); - RNA_def_property_ui_text(prop, "Show Active States", "Show only actuators connected to active states"); - RNA_def_property_update(prop, NC_LOGIC, NULL); - -} - static void rna_def_space_clip(BlenderRNA *brna) { StructRNA *srna; @@ -4703,7 +4631,6 @@ void RNA_def_space(BlenderRNA *brna) rna_def_space_userpref(brna); rna_def_node_tree_path(brna); rna_def_space_node(brna); - rna_def_space_logic(brna); rna_def_space_clip(brna); } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 88330ad2a8f..fe69b91e833 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -204,12 +204,6 @@ static void rna_userdef_load_ui_update(Main *UNUSED(bmain), Scene *UNUSED(scene) else G.fileflags &= ~G_FILE_NO_UI; } -static void rna_userdef_mipmap_update(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); - rna_userdef_update(bmain, scene, ptr); -} - static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA *ptr) { GPU_set_anisotropic(U.anisotropic_filter); @@ -2282,23 +2276,6 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_userdef_update"); } -static void rna_def_userdef_theme_space_logic(BlenderRNA *brna) -{ - StructRNA *srna; -// PropertyRNA *prop; - - /* space_logic */ - - srna = RNA_def_struct(brna, "ThemeLogicEditor", NULL); - RNA_def_struct_sdna(srna, "ThemeSpace"); - RNA_def_struct_clear_flag(srna, STRUCT_UNDO); - RNA_def_struct_ui_text(srna, "Theme Logic Editor", "Theme settings for the Logic Editor"); - - rna_def_userdef_theme_spaces_main(srna); - -} - - static void rna_def_userdef_theme_space_buts(BlenderRNA *brna) { StructRNA *srna; @@ -3002,7 +2979,6 @@ static void rna_def_userdef_themes(BlenderRNA *brna) {7, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", ""}, {8, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""}, {9, "NODE_EDITOR", ICON_NODETREE, "Node Editor", ""}, - {10, "LOGIC_EDITOR", ICON_LOGIC, "Logic Editor", ""}, {11, "PROPERTIES", ICON_BUTS, "Properties", ""}, {12, "OUTLINER", ICON_OOPS, "Outliner", ""}, {14, "USER_PREFERENCES", ICON_PREFERENCES, "User Preferences", ""}, @@ -3102,12 +3078,6 @@ static void rna_def_userdef_themes(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ThemeNodeEditor"); RNA_def_property_ui_text(prop, "Node Editor", ""); - prop = RNA_def_property(srna, "logic_editor", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(prop, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "tlogic"); - RNA_def_property_struct_type(prop, "ThemeLogicEditor"); - RNA_def_property_ui_text(prop, "Logic Editor", ""); - prop = RNA_def_property(srna, "outliner", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "toops"); @@ -3232,7 +3202,6 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna) rna_def_userdef_theme_space_info(brna); rna_def_userdef_theme_space_userpref(brna); rna_def_userdef_theme_space_console(brna); - rna_def_userdef_theme_space_logic(brna); rna_def_userdef_theme_space_clip(brna); rna_def_userdef_theme_colorset(brna); rna_def_userdef_themes(brna); @@ -4116,13 +4085,6 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Clip Alpha", "Clip alpha below this threshold in the 3D textured view"); RNA_def_property_update(prop, 0, "rna_userdef_update"); - - prop = RNA_def_property(srna, "use_mipmaps", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_MIPMAP); - RNA_def_property_ui_text(prop, "Mipmaps", - "Scale textures for the 3D View (looks nicer but uses more memory and slows image " - "reloading)"); - RNA_def_property_update(prop, 0, "rna_userdef_mipmap_update"); prop = RNA_def_property(srna, "use_16bit_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_16bit_textures", 1); diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index fd30df4293e..c90be35b648 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -75,7 +75,6 @@ static int shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype)) /* allow empty engine string too, this is from older versions that didn't have registerable engines yet */ return (engine_id[0] == '\0' || STREQ(engine_id, RE_engine_id_BLENDER_RENDER) || - STREQ(engine_id, RE_engine_id_BLENDER_GAME) || STREQ(engine_id, RE_engine_id_CYCLES) || !BKE_viewrender_use_shading_nodes_custom(view_render)); } diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index ffac09efdde..750d0c20301 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -116,16 +116,6 @@ void bpy_import_main_set(struct Main *maggie) bpy_import_main = maggie; } -void bpy_import_main_extra_add(struct Main *maggie) -{ - BLI_addhead(&bpy_import_main_list, maggie); -} - -void bpy_import_main_extra_remove(struct Main *maggie) -{ - BLI_remlink_safe(&bpy_import_main_list, maggie); -} - /* returns a dummy filename for a textblock so we can tell what file a text block comes from */ void bpy_text_filename_get(char *fn, size_t fn_len, Text *text) { diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h index 905e045d657..f11571fb933 100644 --- a/source/blender/python/generic/bpy_internal_import.h +++ b/source/blender/python/generic/bpy_internal_import.h @@ -51,12 +51,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found); void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text); -/* The game engine has its own Main struct, if this is set search this rather than G.main */ struct Main *bpy_import_main_get(void); void bpy_import_main_set(struct Main *maggie); -/* This is used for importing text from dynamically loaded libraries in the game engine */ -void bpy_import_main_extra_add(struct Main *maggie); -void bpy_import_main_extra_remove(struct Main *maggie); - #endif /* __BPY_INTERNAL_IMPORT_H__ */ diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index fe7a046d99c..9f3c10bfd67 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -76,7 +76,7 @@ PyObject * PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size); const char * PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */ const char * PyC_UnicodeAsByteAndSize(PyObject *py_str, Py_ssize_t *size, PyObject **coerce); -/* name namespace function for bpy & bge */ +/* name namespace function for bpy */ PyObject * PyC_DefaultNameSpace(const char *filename); void PyC_RunQuicky(const char *filepath, int n, ...); diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index f9098529772..b745563508a 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -180,10 +180,6 @@ if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) endif() -if(WITH_GAMEENGINE) - add_definitions(-DWITH_GAMEENGINE) -endif() - if(WITH_IMAGE_CINEON) add_definitions(-DWITH_CINEON) endif() @@ -306,10 +302,6 @@ if(WITH_OPENSUBDIV) ) endif() -if(WITH_PLAYER) - add_definitions(-DWITH_PLAYER) -endif() - add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/intern/bpy_app_build_options.c b/source/blender/python/intern/bpy_app_build_options.c index d5c325e4317..6e3f8da31f9 100644 --- a/source/blender/python/intern/bpy_app_build_options.c +++ b/source/blender/python/intern/bpy_app_build_options.c @@ -42,7 +42,6 @@ static PyStructSequence_Field app_builtopts_info_fields[] = { {(char *)"cycles", NULL}, {(char *)"cycles_osl", NULL}, {(char *)"freestyle", NULL}, - {(char *)"gameengine", NULL}, {(char *)"image_cineon", NULL}, {(char *)"image_dds", NULL}, {(char *)"image_frameserver", NULL}, @@ -64,7 +63,6 @@ static PyStructSequence_Field app_builtopts_info_fields[] = { {(char *)"mod_smoke", NULL}, {(char *)"collada", NULL}, {(char *)"opencolorio", NULL}, - {(char *)"player", NULL}, {(char *)"openmp", NULL}, {(char *)"openvdb", NULL}, {(char *)"alembic", NULL}, @@ -140,12 +138,6 @@ static PyObject *make_builtopts_info(void) SetObjIncref(Py_False); #endif -#ifdef WITH_GAMEENGINE - SetObjIncref(Py_True); -#else - SetObjIncref(Py_False); -#endif - #ifdef WITH_CINEON SetObjIncref(Py_True); #else @@ -272,12 +264,6 @@ static PyObject *make_builtopts_info(void) SetObjIncref(Py_False); #endif -#ifdef WITH_PLAYER - SetObjIncref(Py_True); -#else - SetObjIncref(Py_False); -#endif - #ifdef _OPENMP SetObjIncref(Py_True); #else diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 5a309339e17..948a78d5794 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -59,8 +59,6 @@ static PyStructSequence_Field app_cb_info_fields[] = { {(char *)"load_post", (char *)"on loading a new blend file (after)"}, {(char *)"save_pre", (char *)"on saving a blend file (before)"}, {(char *)"save_post", (char *)"on saving a blend file (after)"}, - {(char *)"game_pre", (char *)"on starting the game engine"}, - {(char *)"game_post", (char *)"on ending the game engine"}, {(char *)"version_update", (char *)"on ending the versioning code"}, /* sets the permanent tag */ diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index 01a25137a98..0e2efe152c3 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -170,7 +170,6 @@ static eSpace_Type rna_Space_refine_reverse(StructRNA *srna) if (srna == &RNA_SpaceNLA) return SPACE_NLA; if (srna == &RNA_SpaceTimeline) return SPACE_TIME; if (srna == &RNA_SpaceNodeEditor) return SPACE_NODE; - if (srna == &RNA_SpaceLogicEditor) return SPACE_LOGIC; if (srna == &RNA_SpaceConsole) return SPACE_CONSOLE; if (srna == &RNA_SpaceUserPreferences) return SPACE_USERPREF; if (srna == &RNA_SpaceClipEditor) return SPACE_CLIP; diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h index ec927a9e316..01d2350d7fd 100644 --- a/source/blender/python/mathutils/mathutils.h +++ b/source/blender/python/mathutils/mathutils.h @@ -62,7 +62,7 @@ enum { float *_data; /* array of data (alias), wrapped status depends on wrapped status */ \ PyObject *cb_user; /* if this vector references another object, otherwise NULL, \ * *Note* this owns its reference */ \ - unsigned char cb_type; /* which user funcs do we adhere to, RNA, GameObject, etc */ \ + unsigned char cb_type; /* which user funcs do we adhere to, RNA, etc */ \ unsigned char cb_subtype; /* subtype: location, rotation... \ * to avoid defining many new functions for every attribute of the same type */ \ unsigned char flag /* wrapped data type? */ \ diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 5cbc907d9c6..c5042bf3f83 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -149,10 +149,6 @@ if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) endif() -if(WITH_GAMEENGINE) - add_definitions(-DWITH_GAMEENGINE) -endif() - if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index 8e9d005df9c..64d87876a2e 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -60,7 +60,7 @@ struct ViewLayer; /* RenderEngineType.flag */ #define RE_INTERNAL 1 -#define RE_GAME 2 +/* #define RE_FLAG_DEPRECATED 2 */ #define RE_USE_PREVIEW 4 #define RE_USE_POSTPROCESS 8 #define RE_USE_SHADING_NODES 16 diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 245a49ad5ae..824d37b360f 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -80,25 +80,11 @@ static RenderEngineType internal_render_type = { {NULL, NULL, NULL} }; -#ifdef WITH_GAMEENGINE - -static RenderEngineType internal_game_type = { - NULL, NULL, - "BLENDER_GAME", N_("Blender Game"), RE_INTERNAL | RE_GAME | RE_USE_LEGACY_PIPELINE, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - {NULL, NULL, NULL} -}; - -#endif - ListBase R_engines = {NULL, NULL}; void RE_engines_init(void) { RE_engines_register(NULL, &internal_render_type); -#ifdef WITH_GAMEENGINE - RE_engines_register(NULL, &internal_game_type); -#endif DRW_engines_register(); } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index c42f85ef017..8bc6f025d11 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -670,9 +670,7 @@ static int check_mode_full_sample(RenderData *rd, ViewRender *view_render) const char *engine_id = view_render->engine_id; int scemode = rd->scemode; - if (!STREQ(engine_id, RE_engine_id_BLENDER_RENDER) && - !STREQ(engine_id, RE_engine_id_BLENDER_GAME)) - { + if (!STREQ(engine_id, RE_engine_id_BLENDER_RENDER)) { scemode &= ~R_FULL_SAMPLE; } diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index da61a201ef6..d74cf15d78b 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -42,7 +42,6 @@ set(INC ../makesrna ../nodes ../render/extern/include - ../../gameengine/BlenderRoutines ../../../intern/clog ../../../intern/ghost ../../../intern/guardedalloc @@ -143,10 +142,6 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -if(WITH_GAMEENGINE) - add_definitions(-DWITH_GAMEENGINE) -endif() - if(WITH_BUILDINFO) add_definitions(-DWITH_BUILDINFO) endif() diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 377d274a712..7869973f1ec 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -91,7 +91,6 @@ void WM_exit (struct bContext *C) ATTR_NORETURN; void WM_main (struct bContext *C) ATTR_NORETURN; -bool WM_init_game (struct bContext *C); void WM_init_splash (struct bContext *C); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 9dcb83244ca..ef8888c9f87 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -881,8 +881,6 @@ int wm_homefile_read( /* start with save preference untitled.blend */ G.save_over = 0; - /* disable auto-play in startup.blend... */ - G.fileflags &= ~G_FILE_AUTOPLAY; wm_file_read_post(C, true, use_userdef); @@ -1192,7 +1190,6 @@ static int wm_file_write(bContext *C, const char *filepath, int fileflags, Repor } SET_FLAG_FROM_TEST(G.fileflags, fileflags & G_FILE_COMPRESS, G_FILE_COMPRESS); - SET_FLAG_FROM_TEST(G.fileflags, fileflags & G_FILE_AUTOPLAY, G_FILE_AUTOPLAY); /* prevent background mode scripts from clobbering history */ if (do_history) { @@ -1300,7 +1297,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w } else { /* save as regular blend file */ - int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_HISTORY); + int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); ED_editors_flush_edits(C, false); @@ -1427,7 +1424,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op) ED_editors_flush_edits(C, false); /* force save as regular blend file */ - fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_HISTORY); + fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); if (BLO_write_file(CTX_data_main(C), filepath, fileflags | G_FILE_USERPREFS, op->reports, NULL) == 0) { printf("fail\n"); diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 4c7c2cc96e4..2af478b9470 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -86,9 +86,6 @@ #include "BPY_extern.h" #endif -#ifdef WITH_GAMEENGINE -# include "BL_System.h" -#endif #include "GHOST_Path-api.h" #include "GHOST_C-api.h" @@ -193,7 +190,7 @@ void WM_init(bContext *C, int argc, const char **argv) ED_file_init(); /* for fsmenu */ ED_node_init_butfuncs(); - BLF_init(); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */ + BLF_init(); BLT_lang_init(); /* reports cant be initialized before the wm, @@ -218,7 +215,7 @@ void WM_init(bContext *C, int argc, const char **argv) GPU_init(); - GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); + GPU_set_mipmap(true); GPU_set_linear_mipmap(true); GPU_set_anisotropic(U.anisotropic_filter); GPU_set_gpu_mipmapping(U.use_gpu_mipmap); @@ -324,96 +321,6 @@ void WM_init_splash(bContext *C) } } -bool WM_init_game(bContext *C) -{ - wmWindowManager *wm = CTX_wm_manager(C); - wmWindow *win; - - ScrArea *sa; - ARegion *ar = NULL; - - Scene *scene = CTX_data_scene(C); - - if (!scene) { - /* XXX, this should not be needed. */ - Main *bmain = CTX_data_main(C); - scene = bmain->scene.first; - } - - win = wm->windows.first; - - /* first to get a valid window */ - if (win) - CTX_wm_window_set(C, win); - - sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0); - ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); - - /* if we have a valid 3D view */ - if (sa && ar) { - ARegion *arhide; - - CTX_wm_area_set(C, sa); - CTX_wm_region_set(C, ar); - - /* disable quad view */ - if (ar->alignment == RGN_ALIGN_QSPLIT) - WM_operator_name_call(C, "SCREEN_OT_region_quadview", WM_OP_EXEC_DEFAULT, NULL); - - /* toolbox, properties panel and header are hidden */ - for (arhide = sa->regionbase.first; arhide; arhide = arhide->next) { - if (arhide->regiontype != RGN_TYPE_WINDOW) { - if (!(arhide->flag & RGN_FLAG_HIDDEN)) { - ED_region_toggle_hidden(C, arhide); - } - } - } - - /* full screen the area */ - if (!sa->full) { - ED_screen_state_toggle(C, win, sa, SCREENMAXIMIZED); - } - - /* Fullscreen */ - if ((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) { - WM_operator_name_call(C, "WM_OT_window_fullscreen_toggle", WM_OP_EXEC_DEFAULT, NULL); - wm_get_screensize(&ar->winrct.xmax, &ar->winrct.ymax); - ar->winx = ar->winrct.xmax + 1; - ar->winy = ar->winrct.ymax + 1; - } - else { - GHOST_RectangleHandle rect = GHOST_GetClientBounds(win->ghostwin); - ar->winrct.ymax = GHOST_GetHeightRectangle(rect); - ar->winrct.xmax = GHOST_GetWidthRectangle(rect); - ar->winx = ar->winrct.xmax + 1; - ar->winy = ar->winrct.ymax + 1; - GHOST_DisposeRectangle(rect); - } - - WM_operator_name_call(C, "VIEW3D_OT_game_start", WM_OP_EXEC_DEFAULT, NULL); - - BKE_sound_exit(); - - return true; - } - else { - ReportTimerInfo *rti; - - BKE_report(&wm->reports, RPT_ERROR, "No valid 3D View found, game auto start is not possible"); - - /* After adding the report to the global list, reset the report timer. */ - WM_event_remove_timer(wm, NULL, wm->reports.reporttimer); - - /* Records time since last report was added */ - wm->reports.reporttimer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER, 0.02); - - rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo"); - wm->reports.reporttimer->customdata = rti; - - return false; - } -} - /* free strings of open recent files */ static void free_openrecent(void) { @@ -491,7 +398,7 @@ void WM_exit_ext(bContext *C, const bool do_python) /* save the undo state as quit.blend */ char filename[FILE_MAX]; bool has_edited; - int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_HISTORY); + int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); BLI_make_file_string("/", filename, BKE_tempdir_base(), BLENDER_QUIT_FILE); @@ -625,9 +532,6 @@ void WM_exit_ext(bContext *C, const bool do_python) wm_ghost_exit(); CTX_free(C); -#ifdef WITH_GAMEENGINE - SYS_DeleteSystem(SYS_GetSystem()); -#endif GHOST_DisposeSystemPaths(); |